all groups > sql server dts > january 2005 >
You're in the

sql server dts

group:

Problem Transact-SQL Statement


Re: Problem Transact-SQL Statement Hilary Cotter
1/6/2005 12:22:14 PM
sql server dts: sounds like someone is building a commands which will appear in the results
pane. Then they expect the dba to paste them from the results pane back into
the query pane and execute them there.

Or perhaps the dba/developers is building strings to be executed by dynamic
sql.

The rules are ' delimits a character string. So if you want a character
string of test it would be delimited by 'test'.

When you want a single quotation mark to appear in your string you are
building you would delimit it like this ''', a preferable way is to replace
this with a select char(39) for readability purposes.

HTH

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
[quoted text, click to view]

Problem Transact-SQL Statement Allen Yu
1/7/2005 12:54:25 AM
I've come across a Transact-SQL statement as follows:

-- Statements start here

select 'EXECUTE sp_changeobjectowner ''' + name + ''', ''dbo''' from
sysobjects where type = 'U'

-- end here

Questions:

(1) How should the 'select' statement be interpreted?

(2) What are the rules for using the quotation marks: ''', '',,, etc?

Thanks!

Allen


AddThis Social Bookmark Button