Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Oh guru how can I delete using a stored procedure ..from two tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-25 : 16:11:32
Sheraz (The rookie) writes "Oh guru how can I delete using a stored procedure ..from two tables?


Now I am a newbie..

Now i created two identical tables with same column names.
I also created a stored procedure which shoudl take a value as a parameter.

ideally the procedure should delete the required row from both table :P

But may be i made one of those ..newbie mistakes...I haven't bothered with PK or fk Just yet .. just trying to get the delete procedure going .. with miminmum level of difficulty


Here is my Procedure
************************************************************

CREATE Proc mydelete
@name varchar (15)

As

Delete testtable where name = '@name'
Delete testtable2 where name = '@name'
GO

*************************************************************

EXEC mydelete 'abcd'

Table structure is

testtable
name varchar(15)
note varchar(15)

testtable2
name varchar(15)
note varchar(15)

)))))))))))))))))))))))))))))))))))))))The End(((((((((((((((((


Note the delete statements work fine if i execute them individually with typing the parameter which will help me delete the row I want to delete from table . But from within a procedure it just doesn't work ...

As I head out in the sun set .. I say one last word



"Help" nah just kidding .. "
   

- Advertisement -