SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


EXECUTE


EXECUTE

Author
Message
Henrico Bekker
Henrico Bekker
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3720 Visits: 4371

One question though if you execute you should get error below,

Msg 134, Level 15, State 1, Line 9
The variable name '@sqlstring' has already been declared. Variable names must be unique within a query batch or stored procedure.


actually not. 2 statements, not a single batch query.
JAZZ Master
JAZZ Master
UDP Broadcaster
UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)

Group: General Forum Members
Points: 1449 Visits: 857
Good question.
GPO
GPO
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1319 Visits: 1929
While we're being pedantic...

I would have thought the answer depends on your permissions. If you can't run dbcc showfilestats then both will fail.

:-)

One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important.
Bertrand Russell

Tom Thomson
Tom Thomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14606 Visits: 12238
Henrico Bekker (2/16/2012)
actually not. 2 statements, not a single batch query.

There aren't two statements, there are 6. If you'd said "two batches of statements" instead of "two statements" the thing would have made sense. But you didn't. Since it is necessary to execute at least three statements - ie a batch of statements not a single statement - to get any meningful result, we have to assume you are referring to two of the statements in however many batches you supplied; and you supplied something that was plainly and clearly one batch, not two, so it was reasonable to assume it was intended to as a singe batch (Occam's razor is applicable: there was no "go" anywhere between the two declarations, and there was no necessity to invent one). So as it stands, your reply to Satish seems to me to be nothing other than inaccurate nonsense.

Are think you are lucky there's no-one screaming about a "trick" question; I'm not, because I never attribute to malice (nor even to stupidity) that which is more easily explained as a simple oversight. Satish didn't eithesuggest a "trick" either, maybe for the same reason.

And, just as an aside: I now see that I must use more than 2 emoticons per post if I want to clown anywhere John Mitchell-245523 is likely to see it.

Tom

Henrico Bekker
Henrico Bekker
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3720 Visits: 4371
So as it stands, your reply to Satish seems to me to be nothing other than inaccurate nonsense.


next time, I'll run it past you, to ensure it meets YOUR requirements.
I'll ask Steve to give you the 1 point as it ruined your day apparently.
Tom Thomson
Tom Thomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14606 Visits: 12238
Henrico Bekker (2/20/2012)
So as it stands, your reply to Satish seems to me to be nothing other than inaccurate nonsense.


next time, I'll run it past you, to ensure it meets YOUR requirements.
I'll ask Steve to give you the 1 point as it ruined your day apparently.

Try not to be more of an arrogant idiot than you can help.

Tom

GPO
GPO
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1319 Visits: 1929
Tom and Enrico

I'm only learning this stuff (SQL Server). That's why I come here. There seems to be a better cross section of SQL experts here than I have found at other fora. The spat that this discussion has descended into though, is a rather unedifying spectacle. I get the arguments on both sides. I don't get the personal attacks. You guys contribute, presumably out of altruism, and those of us still getting a handle on the caper are the better for it. Don't throw the baby out with the bathwater. It belittles you both.;-)

:-)

One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important.
Bertrand Russell

kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3133 Visits: 2766
thanks,
Its good to know this....

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
kapil_kk
kapil_kk
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3133 Visits: 2766
We can also use any no. of semicolon before WITH also -
;;;with CTE as (select * from LocationMaster)
select LocationName from CTE

So, semicolon doesnt make any effect that how many semicolons you used after any statement or as a prefix to WITH while writing a CTE expression...:-P

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Neeraj Prasad Sharma
Neeraj Prasad Sharma
Old Hand
Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)

Group: General Forum Members
Points: 365 Visits: 675
i did something in past 1+

Neeraj Prasad Sharma
Sql Server Tutorials
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search