By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,575 Members | 1,948 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,575 IT Pros & Developers. It's quick & easy.

sql AS function not working

P: 3
I've been working on the following sp for a few days now. This is a stripped down version. It functions correctly, however when I run it (in the sql server mgt console), it returns the column as "(No column name)". Using "select @WrkStr AS StrOut" does not set the column name as StrOut. Any suggestions would be greatly appreciated.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[sp_Test]
@IncRecIdx int,
@TmpStr varchar(50),
@WrkStr varchar(8000)
AS
---------------------------------------------------------------------------------
set @TmpStr = (select case when chkInc_Abuse_Alleged = 1 then
'Abuse Alleged' else null end from Incident_4 where IncRecIdx = @IncRecIdx)
if len(@WrkStr) = 0 or @WrkStr is null
set @WrkStr = @TmpStr
else
set @WrkStr = @WrkStr + ', ' + @TmpStr
---------------------------------------------------------------------------------
set @TmpStr = (select case when chkInc_Burn = 1 then
'Burn' else null end from Incident_4 where IncRecIdx = @IncRecIdx)
if len(@WrkStr) = 0 or @WrkStr is null
set @WrkStr = @TmpStr
else
set @WrkStr = @WrkStr + ', ' + @TmpStr
---------------------------------------------------------------------------------

select @WrkStr AS StrOut

--exec sp_Incident_4_Test 1001
Jul 2 '09 #1
Share this Question
Share on Google+
5 Replies


ck9663
Expert 2.5K+
P: 2,878
Try passing 3 parameters instead of just 1


--- CK
Jul 3 '09 #2

P: 3
It only accepts 1 parameter, If I try exec sp_Incident_4_Test 1001, ' ', ' ' i receive the error message Procedure or function sp_Incident_4_Test has too many arguments specified.
Jul 3 '09 #3

P: 5
How r u executing this SP?

Pls provide exec Statement...

As the statement written over here is not matching with your SP name in which u r facing problem.
Jul 8 '09 #4

ck9663
Expert 2.5K+
P: 2,878
And the SP parameter on the script is 3, yet there's an error that it can not accept 3 parameters.

-- CK
Jul 8 '09 #5

P: 3
Got it figured out, sometimes I feel so stupid, duh...

Thanks
Jul 8 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.