January 8, 2009 at 6:20 am
I have a stored procedure which returns XML data.The select query is as follows:
SELECT
null GroupType,
FROM
Groups
WHERE
1 = 2
UNION ALL
SELECT
Case
When G.PlantCD is Null Then "0"
Else G.PlantCD
End As GroupType,
FROM
Groups G
INNER JOIN SecurityLevels sl
on G.SecurityLevelID = sl.SecurityLevelID
WHERE
G.GroupID = @GroupID
FOR XML AUTO, ELEMENTS
When I run the query it throws an error at "0" as it's not a valid column but this sp is running in production without any issue.When I execute the existing sp with the parameter groupid it runs.but if I try to alter this sp or create a similar sp it throws the error.
How is this happening?
Thanks.
January 23, 2009 at 5:16 am
Use single quotes to delimit explicit character values.
Double quotes can be used to delimit object identifiers (e.g. if they contain special characters). Look up the QUOTED_IDENTIFIER option in Books Online.
ML
---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply