Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Sunday, March 25, 2012

Adding a Delete functionality to my Shopping Cart

Hello,

I'm in the progress of developing a shopping cart system that operates with an SQL database in Visual Web Developer 2005. I've managed to successfully add items to the cart and display them, but I'm having trouble providing the user with the option of removing items from the cart.

My understanding so far is that I've got to adjust the DELETE SQL statement of the data source. At first I was thinking along the lines of a simple statement:

DELETE * FROM ShoppingCart WHERE CartID=@.CartID AND CategoryID=@.CategoryID AND ProductID=@.ProductID

However, I've realised that the parameters I need for this SQL query aren't automatically passed in when a user clicks the "Delete" text of the Delete field (at least I think this is the problem).

The error message which I'm getting when I try to remove an item from the cart is as follows:

Incorrect syntax near '*'.

If anyone could let me know where I'm going wrong and point me in the right direction I'd be really grateful.

Thank you,

Luke

Hi Luke,

There should not be an asterisk (*) in your DELETE statement. If you remove that you might have better luck.|||

Thanks very much for your help - I thought it might have been a really stupid mistake like that! Anyway everything is working fine now.

Thanks again,

Luke

Thursday, March 8, 2012

Add or Modify Keys in Merge Replication

I have several articles in a SQL Server 2000 merge publication where I need to do one of the following:
1. Delete a existing key and its column, and create a new one with a new column.
2. Add a new key using existing columns.
3. Add a new key using a new column to be added.
Since this is merge replication, I cannot drop the articles involved using sp_droparticle and then use sp_addarticle after making the modifications.
The publication has several active subscriptions.
Any suggestions and/or procedures for above 3 items would be very much appreciated.
Thanks.
Bill
Bill,
have a look at these three procedures to do what you require:
sp_repladdcolumn, sp_repldropcolumn and sp_addscriptexec.
For your three cases, something like:
1. sp_addscriptexec (alter table x drop constraint y), sp_repldropcolumn ,
sp_repladdcolumn
2. sp_addscriptexec (alter table x add constraint ...)
3. sp_repladdcolumn
For the sp_addscriptexecs don't forget to do the same process on the
publisher, and be sure to get the syntax correct, otherwise there'll be a
continuous error.
HTH,
Paul Ibison
|||Thanks you, Paul! I will give these solutions a try.
"Paul Ibison" wrote:

> Bill,
> have a look at these three procedures to do what you require:
> sp_repladdcolumn, sp_repldropcolumn and sp_addscriptexec.
> For your three cases, something like:
> 1. sp_addscriptexec (alter table x drop constraint y), sp_repldropcolumn ,
> sp_repladdcolumn
> 2. sp_addscriptexec (alter table x add constraint ...)
> 3. sp_repladdcolumn
> For the sp_addscriptexecs don't forget to do the same process on the
> publisher, and be sure to get the syntax correct, otherwise there'll be a
> continuous error.
> HTH,
> Paul Ibison
>
>
|||Having done one of these (my situation calls for nuber 1) would I have to
reinitialise the snapshot?
On Mon, 5 Jul 2004 20:04:21 +0100, Paul Ibison <Paul.Ibison@.Pygmalion.Com>
wrote:

> Bill,
> have a look at these three procedures to do what you require:
> sp_repladdcolumn, sp_repldropcolumn and sp_addscriptexec.
> For your three cases, something like:
> 1. sp_addscriptexec (alter table x drop constraint y), sp_repldropcolumn
> ,
> sp_repladdcolumn
> 2. sp_addscriptexec (alter table x add constraint ...)
> 3. sp_repladdcolumn
> For the sp_addscriptexecs don't forget to do the same process on the
> publisher, and be sure to get the syntax correct, otherwise there'll be a
> continuous error.
> HTH,
> Paul Ibison
>
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
|||"Paul Ibison" wrote:

> Bill,
> have a look at these three procedures to do what you require:
> sp_repladdcolumn, sp_repldropcolumn and sp_addscriptexec.
> For your three cases, something like:
> 1. sp_addscriptexec (alter table x drop constraint y), sp_repldropcolumn ,
> sp_repladdcolumn
> 2. sp_addscriptexec (alter table x add constraint ...)
> 3. sp_repladdcolumn
> For the sp_addscriptexecs don't forget to do the same process on the
> publisher, and be sure to get the syntax correct, otherwise there'll be a
> continuous error.
> HTH,
> Paul Ibison
>
>
|||Paul:
I tried using sp_addscriptexec to test the deletion of an existing key. However,
when the subscriber synchronizes, the script fails to run. It keeps saying the
script file or directory does not exists. However, it clearly does exist in the
path that is shown in the error.
The synchronization takes place over the internet. When I have run sp_addscripexec
I have tried each of the following in specifying the location of the script file on
the publisher/distributor:
-- "C:\<directory>\<sub directory>\<script file name>"
-- "\\<server name>\<share name>\<sub directory>\<script file name>"
-- "\\<IP of the server>\<share name>\<sub directory>\<script file name>"
-- "\\<URL of the server>\<share name>\<sub directory>\<script file name>"
The last one does not work when I run sp_addscriptexec. However, the first three
do. After sp_addscriptexec runs, it adds the script file to the snapshot location
on the server. I am running sp_addscriptexec at the publisher through a remote
desktop connection.
When the subscriber synchronizes, in the merge agent session details, the
synchronization is successful and data changes are merged, however, one of the
details shows the error that "osql" cannot find the file or directory at:
"\\<server name>\C$\<share name>\<snapshots folder>\<some long date & time
string>\<script file name>". The "<server name>" is the name of the
publisher\distributor.
I must be missing some step but I find nothing in BOL that helps. I also searched
Micorsoft.com and used Google to look for the osql error, but find nothing.
Do you or does anyone else have any suggestions or ideas to try?
Thanks in advance.
Bill
"Paul Ibison" wrote:

> Bill,
> have a look at these three procedures to do what you require:
> sp_repladdcolumn, sp_repldropcolumn and sp_addscriptexec.
> For your three cases, something like:
> 1. sp_addscriptexec (alter table x drop constraint y), sp_repldropcolumn ,
> sp_repladdcolumn
> 2. sp_addscriptexec (alter table x add constraint ...)
> 3. sp_repladdcolumn
> For the sp_addscriptexecs don't forget to do the same process on the
> publisher, and be sure to get the syntax correct, otherwise there'll be a
> continuous error.
> HTH,
> Paul Ibison
>
>
|||are you on the network? If you are not connected to the network or the
internet you will get this error.
If you are running workstation or professional you may have exceeded the
number of simultaneous connections for your os.
You may need to issue a net stop server and then a net start server and try
again.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Bill" <Bill@.discussions.microsoft.com> wrote in message
news:43B07A06-4DBC-48C1-A815-E11BA7103C04@.microsoft.com...
> Paul:
> I tried using sp_addscriptexec to test the deletion of an existing key.
However,
> when the subscriber synchronizes, the script fails to run. It keeps
saying the
> script file or directory does not exists. However, it clearly does exist
in the
> path that is shown in the error.
> The synchronization takes place over the internet. When I have run
sp_addscripexec
> I have tried each of the following in specifying the location of the
script file on
> the publisher/distributor:
> -- "C:\<directory>\<sub directory>\<script file name>"
> -- "\\<server name>\<share name>\<sub directory>\<script file name>"
> -- "\\<IP of the server>\<share name>\<sub directory>\<script file name>"
> -- "\\<URL of the server>\<share name>\<sub directory>\<script file name>"
> The last one does not work when I run sp_addscriptexec. However, the
first three
> do. After sp_addscriptexec runs, it adds the script file to the snapshot
location
> on the server. I am running sp_addscriptexec at the publisher through a
remote
> desktop connection.
> When the subscriber synchronizes, in the merge agent session details, the
> synchronization is successful and data changes are merged, however, one of
the
> details shows the error that "osql" cannot find the file or directory at:
> "\\<server name>\C$\<share name>\<snapshots folder>\<some long date & time
> string>\<script file name>". The "<server name>" is the name of the
> publisher\distributor.
> I must be missing some step but I find nothing in BOL that helps. I also
searched
> Micorsoft.com and used Google to look for the osql error, but find
nothing.[vbcol=seagreen]
> Do you or does anyone else have any suggestions or ideas to try?
> Thanks in advance.
> Bill
>
> "Paul Ibison" wrote:
,[vbcol=seagreen]
a[vbcol=seagreen]

Thursday, February 16, 2012

add an attribute to an existing dimension

Hello experts,

Is there a possibility to add an attribute to an existing dimension? (AS2005)

Right now I solve this problem with delete and create this dimension, but it’s a bad solution because a delete all properties too.

Best regards

Alex

If the dimension is based off a table or view reference in the DSV, right-click the background of the DSV and select Refresh. If you are using a named query, you will need to add the field to the query.

Then, go to the dimension editor. The subset of the DSV displayed in the editor should now show the field. Drag that field to the attribute hierarchy list on the left. You now have a new attribute hierarchy.

Make sure its relationships to other attribute hierarchies are appropriately set.

B.

|||

Hello Bryan

Thank you very much. It’s very easy if you know where you have to click ^^

Have a nice day

Thursday, February 9, 2012

Activity on a database?

Hi everyone, I have an SQL2000 with quiet a lot databases and I want to
delete some of them. How do I know if there has been any kind of activity on
a certain database, so I dont delete one that is being used.
Thanks a lot,
Ivan MckenzieTry seting up a trace, but just put in the connections,
then look at the databases connected to.
J
>--Original Message--
>Hi everyone, I have an SQL2000 with quiet a lot
databases and I want to
>delete some of them. How do I know if there has been any
kind of activity on
>a certain database, so I dont delete one that is being
used.
>Thanks a lot,
>Ivan Mckenzie
>
>.
>|||Thanks, I suppose this is done with SQL profiler.
"Julie" <anonymous@.discussions.microsoft.com> escribió en el mensaje
news:2d1d201c469d7$11c0f540$a501280a@.phx.gbl...
> Try seting up a trace, but just put in the connections,
> then look at the databases connected to.
> J
>
> >--Original Message--
> >Hi everyone, I have an SQL2000 with quiet a lot
> databases and I want to
> >delete some of them. How do I know if there has been any
> kind of activity on
> >a certain database, so I dont delete one that is being
> used.
> >
> >Thanks a lot,
> >
> >Ivan Mckenzie
> >
> >
> >.
> >|||Hi,
Run the Profiler for couple of week days . Identify the databases not being
used. Make those databases
offline for minimum 15 days using the below command.
alter database <dbname> set offline
If you are not getting any calls regarding that database, you can backup
those databases , copy to a Tape (or other safe location) and delete the
database.
--
Thanks
Hari
MCDBA
"Ivan Mckenzie" <imck@.inerza.com> wrote in message
news:u6LMgydaEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Thanks, I suppose this is done with SQL profiler.
>
> "Julie" <anonymous@.discussions.microsoft.com> escribió en el mensaje
> news:2d1d201c469d7$11c0f540$a501280a@.phx.gbl...
> >
> > Try seting up a trace, but just put in the connections,
> > then look at the databases connected to.
> >
> > J
> >
> >
> > >--Original Message--
> > >Hi everyone, I have an SQL2000 with quiet a lot
> > databases and I want to
> > >delete some of them. How do I know if there has been any
> > kind of activity on
> > >a certain database, so I dont delete one that is being
> > used.
> > >
> > >Thanks a lot,
> > >
> > >Ivan Mckenzie
> > >
> > >
> > >.
> > >
>|||Thanks a lot.
"Hari Prasad" <hari_prasad_k@.hotmail.com> escribió en el mensaje
news:%23V5N%23SiaEHA.3420@.TK2MSFTNGP12.phx.gbl...
> Hi,
> Run the Profiler for couple of week days . Identify the databases not
being
> used. Make those databases
> offline for minimum 15 days using the below command.
> alter database <dbname> set offline
> If you are not getting any calls regarding that database, you can backup
> those databases , copy to a Tape (or other safe location) and delete the
> database.
> --
> Thanks
> Hari
> MCDBA
> "Ivan Mckenzie" <imck@.inerza.com> wrote in message
> news:u6LMgydaEHA.1652@.TK2MSFTNGP09.phx.gbl...
> > Thanks, I suppose this is done with SQL profiler.
> >
> >
> >
> > "Julie" <anonymous@.discussions.microsoft.com> escribió en el mensaje
> > news:2d1d201c469d7$11c0f540$a501280a@.phx.gbl...
> > >
> > > Try seting up a trace, but just put in the connections,
> > > then look at the databases connected to.
> > >
> > > J
> > >
> > >
> > > >--Original Message--
> > > >Hi everyone, I have an SQL2000 with quiet a lot
> > > databases and I want to
> > > >delete some of them. How do I know if there has been any
> > > kind of activity on
> > > >a certain database, so I dont delete one that is being
> > > used.
> > > >
> > > >Thanks a lot,
> > > >
> > > >Ivan Mckenzie
> > > >
> > > >
> > > >.
> > > >
> >
> >
>