Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters 1

Status
Not open for further replies.

drallabs

Technical User
Mar 2, 2006
28
US
Can you use a parameter in a stored procedure to select a table? e.g.,

create procedure pStandEditErrorCheck @standedit char(6)
as

--Check for Duplicate Standids
SELECT standid, count(*) AS Total_Duplicate_Standids
FROM @standedit--stand_edits
GROUP BY standid
HAVING count(*) > 1

return
 
No.

The only way would be to use dynamic sql to make this happen. This then gives you security issues that you would need to resolve.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
is there a way to pass in any table into a batch process or stored procedure. I am attempting to build a batch/stored procedure that can take any table as input without having to hard-code in the name of the table.
 
Again, only via dynamic SQL.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top