Re: is this bad?
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 11/03/04
- Next message: Aaron [SQL Server MVP]: "Re: taking off decimals"
- Previous message: Zach Wells: "Re: taking off decimals"
- In reply to: djc: "Re: is this bad?"
- Next in thread: Scott Simons: "Re: is this bad?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 03 Nov 2004 23:03:45 +0100
On Wed, 3 Nov 2004 07:48:08 -0500, djc wrote:
>I am VERY new to stored procedure so I am making 3 assumptions from your
>example below. Please let me know if I'm correct.
>
>1) the ';' character must mark the end of a statement. So this makes the
>query sort by the first column then end the statement.
Hi djc,
This is incorrect. Previous versions of SQL Server choked on a ; at the
end of a statement. Newer versions do accept this, but it's still
optional. You could remove all ';' marks from any SQL script and SQL
Server will still happily execute it.
I only included the semicolons because you did - to make the code easier
to understand for you.
>2) the second statement deletes my table (yikes!)
Correct. Note that a DROP DATABASE statement would also have fit in the
varchar(50) positions available!!
>3) the '--' character must mark the beginning of a comment... which comments
>out any remaining code in the stored procedure.
Yep. That's to prevent errors. (If the rest of the code yields a syntax
error, nothing would get executed and your table would survive the
experiment).
>wow. thats way too easy, if I'm correct.
It is. That's why I posted my warning.
In case you haven't done so yet, go and read the information at Erland's
page NOW! --> http://www.sommarskog.se/dynamic_sql.html
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Aaron [SQL Server MVP]: "Re: taking off decimals"
- Previous message: Zach Wells: "Re: taking off decimals"
- In reply to: djc: "Re: is this bad?"
- Next in thread: Scott Simons: "Re: is this bad?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|