Sabtu, 25 Agustus 2012

sql comment

When developing, we can always use remark code, a code will be ignored when execute. There are two script comment on sql server, comment line and block comment.

See example below:

this is
sql server
comment line
select 'computer'product_name,(5)qty

#Results:
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'is'. 

--this is
--sql server
--comment line
select 'computer'product_name,(5)qty


#Results:
product_name    qty
computer          5



/*this is
sql server
block comment*/
select 'computer'product_name,(5)qty



#Results:
product_name    qty
computer          5






Tidak ada komentar:

Posting Komentar