May 3, 2012 at 2:09 pm
SELECT TOP 10000 newid, *
FROM [original-data]
WHERE State="PE"
ORDER BY Zip;
The column "newid" does not actually exist in the table [original-data]. I have in mind to create the column so that the value of it for the first row is the number "1". I also have in mind to have "newid" increment automatically for every row thereafter. Is this possible to do with SQL?
Thank You! :w00t: 😀
May 3, 2012 at 2:15 pm
Yes it is, you could cross join the data with a numbers or tally table.
May 3, 2012 at 8:20 pm
You can use ROW_NUMBER() OVER for this.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 3, 2012 at 9:53 pm
Jeff Moden (5/3/2012)
You can use ROW_NUMBER() OVER for this.
That too. Sorry, brain was stuck on tally table as I had just been working with one.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply