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 2008 Forums
 Transact-SQL (2008)
 Need sp for delete data

Author  Topic 

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-11-18 : 02:32:50
Hi,

I am using below query to delete rows from table A which rows are available in table B also (same rows in two table).

So now what i want is i have to specify a column name in where condition but i dont know the column names of table A and table B then

how could i specify a column names in where condition ?

with cte as (select * From ces_test INTERSECT select * from ces_testimport)
DELETE ces from ces_test ces where exists (select 1 from cte where cte.Name = ces.Name) .

Please help me........

Thanks



Manju

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-18 : 03:29:59
hmm...if you dont know what is column to be used in your condition how do you expect us to know it? You've not provided any table structure or other details so unless you do that and explain your rules for deletion we cant help you much

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -