September 9, 2008 at 6:13 am
Hello
I have a query that generates a result set, on a daily bases whereby I need to include a predefined 1st line (010000000YYYMMDD00000000000000.....) which will indicate the beginning of the result set and 090000000..... which will indicate the last line of the result set.
Can anyone help?
September 9, 2008 at 6:17 am
You could use a union ALL
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
September 9, 2008 at 6:32 am
I tried the union all but it gave me duplicate records
September 9, 2008 at 2:39 pm
I have to ask. What is this for?
Sounds like you are creating a flat file with a header. Yuk...
I would create an SP that has a temp table you select your resultset data into with an identity column. Then select into a variable the Min value where the identity column = 1 and the max value where the identity column = SCOPE_IDENTITY(). Then you can concatenate the header string and print it (or use an OUTPUT variable), then select everything from the temp table.
Gary Johnson
Sr Database Engineer
September 10, 2008 at 9:35 am
Hello Gary
You may need to expantiate on what you mean, the method you stated earlier, but I was able to get the desired output with the UNION and not the UNION ALL keyword which worked perfect for me (...thanks Chris!!!)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply