How to delete multiple table records in a single query

Posted by Nav234 under Sql Server on 4/1/2010 | Views : 6955 | Status : [Member] | Replies : 3
Hi all

Im using Vb.net and SQL server

I have tried like

delete  FROM t_tdressordered as a , t_torderform as b
WHERE a.orderform_gid = '10'
and a.orderform_gid = b.orderform_gid



But getting error lik :

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'as'.

Thanks in advance

Regads

Naveen....

S.Naveen...


Responses

Posted by: Vuyiswamb on: 4/1/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
You cannot add an alias if you delete Change your query to look like this

delete tdressordered
FROM t_tdressordered a , t_torderform b
WHERE a.orderform_gid = '10'
and a.orderform_gid = b.orderform_gid


Thank you for posting at dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nav234 on: 4/2/2010 [Member] Starter

Up
0
Down
Im getting error like
Msg 208, Level 16, State 1, Line 1
Invalid object name 'tdressordered'.

S.Naveen...

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/7/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
that means your query should look like this

delete t_tdressordered


FROM t_tdressordered a , t_torderform b

WHERE a.orderform_gid = '10'

and a.orderform_gid = b.orderform_gid


try this one and tell me what you get

Thank you for posting at Dotnetfunda
[Administrator]

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response