April 29, 2005 at 2:22 am
Hello all,
I am trying to include some freeform text in the result set of a query. I am sure it can be done, however, I can't figure out the syntax for the command. Basically what I am trying to to is create a small query around the result of a query, for save to a text file so I can double check it is OK before I run it. As an example.....
I want to query the "sysusers" table, extracting just the name field, however, in the result set I want to print the following text "sp_change_users_login 'update_one', 'USERNAME', 'USERNAME', 'DATABASENAME'" around the result set.
Any help would be appreciated.
regards
Nige.....
April 29, 2005 at 3:04 am
Something like this?
SELECT 'sp_change_users_login ''update_one'', ''' + name + ''', ''' + name + ''', ''' + DB_NAME(0) + ''''
FROM dbo.sysusers
April 29, 2005 at 3:37 am
Thats the syntax, do you think I could figure it out !! Been trying all sorts of weird and wonderfull text strings.......
faaaannnnnttttastic, just what I needed
many many thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply