Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 how to return constant column value in stored proc

Author  Topic 

kpgraci
Yak Posting Veteran

68 Posts

Posted - 2011-05-16 : 15:21:49
If not in a stored procedue I would do this:

SELECT 17.3 AS MyValue, * FROM MyTable

In SP I tried this:

ALTER PROCEDURE dbo.MySP
(
@tz float
)
AS
SELECT @tz AS MyValue, * FROM MyTable
RETURN

And S2010 complains of a systax error near keyword FROM

How can I do this is a SP?

kpg

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-16 : 15:26:44
It works fine for me. Perhaps you've oversimplified your problem for us?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

kpgraci
Yak Posting Veteran

68 Posts

Posted - 2011-05-16 : 15:40:45
oh man, one of those days...I had an extra comma - it works
thanks

kpg
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-16 : 15:41:31


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -