Unix Technical Forum

pass int variable in a sql statement

This is a discussion on pass int variable in a sql statement within the Sybase forums, part of the Database Server Software category; --> Hi, I am writing a stored proc, which gets the row counts of various tables. The table names are ...


Go Back   Unix Technical Forum > Database Server Software > Sybase

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 06:10 PM
dufffman@gmail.com
 
Posts: n/a
Default pass int variable in a sql statement

Hi,

I am writing a stored proc, which gets the row counts of various
tables. The table names are genereated for a table, TableNames.

So I am using somethin like,

select @tableName = tableName
from TableNames

select @sql = "select count(*) from " + @tableName
exec(sql)

I want to keep track of the count i get back from executing this sql.
How would store this data in a variable?

Thanks,

Help much appreciated.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 06:11 PM
wkraatz@csc.com
 
Posts: n/a
Default Re: pass int variable in a sql statement

See the answers to execute dynamic query doubt on Nov. 18.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:29 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com