Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQl 2005 Query

$
0
0

I am not very familiar with SQL at all. Below is a query that has been written for me to delete all the pertinent information out of a database. The only thing I change is the "289". I find the ncdstudy number I need to delete then run the query and it shows me all the rows that were deleted.

My question is I need to delete about 20,000 ncdstudy's. They are in numerical order so I was wondering if I can do like a set @ncdstudy = 1..20000 or is there some way to code it so I can delete a block of NCD study numbers?

Thank YOu.

declare @nCdStudy numeric

set @nCdStudy=289

Delete From Image_Condition where NCDIMAGE in (select ncdimage from image where ncdseries in (select ncdseries from series where ncdstudy=@nCdStudy))

Delete From Image_Mg where NCDIMAGE in (select ncdimage from image where ncdseries in (select ncdseries from series where...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>