Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Abhijit
»
Script to return Rows count from table using...
15 posts, Page 2 of 2
««
1
2
Script to return Rows count from table using sp_ExecuteSQL
Rate Topic
Display Mode
Topic Options
Author
Message
Jeff Moden
Jeff Moden
Posted Tuesday, September 30, 2008 7:15 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 32,910,
Visits: 26,802
You didn't copy the script correctly... you're comparing an Object_ID to a table Name in your from clause.
But, again, all that just isn't necessary. Look at my previous post.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #578791
Andrew Coppock
Andrew Coppock
Posted Wednesday, October 01, 2008 7:42 AM
SSC Rookie
Group: General Forum Members
Last Login: Wednesday, August 08, 2012 7:08 AM
Points: 27,
Visits: 39
... just to be clear
If you will look closely, you will see there are two methods in my script. One is commented out. Both return NULL. It should be noted that if I run the script as TSQL in the actual database (USE mydb) then the script works. It returns NULL when I run it as a proc.
Post #579056
Jeff Moden
Jeff Moden
Posted Wednesday, October 01, 2008 9:02 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 32,910,
Visits: 26,802
What's your point, Andrew? You said the code didn't work... I told you why it didn't. ;)
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #579461
Andrew Coppock
Andrew Coppock
Posted Thursday, October 02, 2008 11:53 AM
SSC Rookie
Group: General Forum Members
Last Login: Wednesday, August 08, 2012 7:08 AM
Points: 27,
Visits: 39
My point is the code doesn't work in a stored procedure, and I hoped someone might know why... Are you trying to say my table name is wrong? I said that I am using table name as a variable to the proc. That is all.
Post #579859
Jeff Moden
Jeff Moden
Posted Thursday, October 02, 2008 9:15 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 32,910,
Visits: 26,802
Heh... No... I'm saying the following is wrong...
FROM sys.tables AS tbl where tbl.
Name
= CAST(
object_id(@TableName)
AS VARCHAR(100)) ORDER BY 1
;)
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #580034
« Prev Topic
|
Next Topic »
15 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.