Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 syntax question

Author  Topic 

sql_mad
Starting Member

5 Posts

Posted - 2007-07-26 : 04:47:15
i came across the following syntax, can anyone explain what the purpose of the comments and the 'as' keyword are here

select "*/ DECLARE @id int" as "/*"

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2007-07-26 : 05:14:39
for what it is being used??
its just returning a column " /* " with value "*/ DECLARE @id int "
Go to Top of Page

sql_mad
Starting Member

5 Posts

Posted - 2007-07-26 : 05:33:42
its part of a script which is used to dynmaically generate another script based on values in a table:

select "*/ DECLARE @id int" as "/*"
select "*/ DECLARE @c char(10)" as "/*"
select "*/ Select @c = 'enroll'" as "/*"

select "*/ Select @id = parm_id from info_table where parm_c = @c and coll_c = '' " as "/*"

select distinct " exec parmu_row "+convert(varchar, ip.id)+", '"+ip.n+"', 'sominfo', 'someinfo', 'someinfo', 'someinfo', 'someinfo', @id, 'Y', '46544'" as '--'
from t_info ip

what is the purpose of the ' as ' and ' "/*" ' at the end of each line can you tell me?


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-07-26 : 09:25:42
The rocket scientist that wrote this "code" is trying to dynamically create a printable version of some code it appears, that they will then cut and paste and execute it it later...

Sad, really



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -