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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another stored procedure question

Status
Not open for further replies.

mgriffith

MIS
Jul 3, 2001
177
US
does anyoen know why this doesn't work..i think it's pretty self-explanatory what i'm trying to do

CREATE PROCEDURE spWorkCenter_SELECT
(
@tblDepartments_Abbrev char(3),
@WorkCenter_ID char(5)

) AS

SELECT
*
FROM
(
SELECT
t.name
FROM
sysobjects t
WHERE
t.name = ( 'tblWC_' + @tblDepartments_Abbrev + '_' + @WorkCenter_ID )
)


thanks again mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
 
I don't think you need parens here:
t.name = ( 'tblWC_' + @tblDepartments_Abbrev + '_' + @WorkCenter_ID )
 
Rewrite it as this:

CREATE PROCEDURE spWorkCenter_SELECT
@tblDepartments_Abbrev char(3),
@WorkCenter_ID char(5)

AS

SELECT t.name
FROM sysobjects t
WHERE
t.name = 'tblWC_' + @tblDepartments_Abbrev + '_' + @WorkCenter_ID

GO


This will work Chris says: "It's time for a beer."
 
what i was trying to do was select everything from a variable table...i actually got it another way using the COLUMNS view


the COLUMNS view has all kinds of cool stuff in it that i needed like whether it was nullable, and the default value

i know all this stuff can be found between sysobjects and syscolumns, but the view is much easier to sort out mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top