Re: sql query which has got 3 dynamic parameters



Vic (vikrantp@xxxxxxxxx) writes:
Thanks Erland for the reply first of all. The thing is like I didn't
really design the system. So here is what I came up with so far. I
have a store procedure to which I pass a number which will give me a
particular entry in that database. say if I type exec SP_FETCH_ROWS 1
its going to return accounting or if I pass 4 its going to return
calendar etc

First: don't name your procedures sp_something, as the sp_ prefix is
reserved for system procedures.

Next, I don't understand what this SP_FETCH_ROWS is supposed to
achieved. It returns a certain table name given its position in the
current collation, but I don't see what this could be useful for,
neither in general, nor in relation to the problem in your original
post.

if @Count = 1 or @Count = 4 or @Count = 7 or @Count = 8 or
@Count >= 14 or
@Count = 17 or @Count = 18 or @Count = 22 or @Count = 25 or
@Count = 27 or @Count = 28 or @Count = 29
exec releases.dbo.SP_FETCH_ROWS @Count
end

which isn't working though. The above loop ideally will give me list
of items at those specific positions in
TestData6061.INFORMATION_SCHEMA.Tables

And then someone adds accounting_bck for some reason and your numbers
get out of sync?


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: dbrpcparam datalen problem
    ... I tried to use it for the store procedure call: ... and which the version of SQL Server following SQL 2008 will not support. ... not support features added in later versions. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: How to check user logon belong to a sql role?
    ... the user logon have permission to any of the database objects. ... How to write this store procedure? ... Have a look at the is_memberfunction in Books Online. ... plsase specify which version of SQL Server you ...
    (microsoft.public.sqlserver.programming)
  • Re: doing select without grant
    ... I want my users to run my store procedure without granting the select on ... grant permission to a created from the certificate. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)
  • Re: Question about move large amount of data from database to database
    ... database table to another database table every week. ... input date range from web UI, my store procedure will take those date ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Query training -- Complex queries
    ... > Update PositionsEOM ... Here you don't have a derived table, but a correlated subquery. ... UPDATE in Books Online. ... is not written for SQL Server. ...
    (microsoft.public.sqlserver.server)