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)
 Can I do this in a query?

Author  Topic 

texas1992
Starting Member

21 Posts

Posted - 2012-01-17 : 07:46:00
I have a query that works fine. However, I am trying to move it to a stored proc but I am getting an error at the AS that I have colored red. The error that I get is "incorrect syntax near the key work 'AS'".

SELECT *, (select SUM(SettlementAmt) FROM tblPlaintiffs WHERE (BPExposure = -1 OR BPExposure = 1) And CaseID = @CASEID AS SettleAmtCalc,
(select RespAtty + '\' + RespLA FROM lkupCounty WHERE JurisID = tblCaseInfo.JurisID) AS Responsible
FROM tblCaseInfo,tblSelectedCases
WHERE tblCaseInfo.CaseID = @CASEID
and tblCaseInfo.CaseID = tblSelectedCases.CaseID

Is it possible to set a parameter to an alias like what I am trying to do?

Thanks for your help.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-01-17 : 07:56:19
) is missing?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

texas1992
Starting Member

21 Posts

Posted - 2012-01-17 : 08:12:38
quote:
Originally posted by webfred

) is missing?


No, you're never too old to Yak'n'Roll if you're too young to die.



OK, I feel like a complete idiot. I am just getting back into the programming arena after a 5 year absence. Thanks for your help.
Go to Top of Page
   

- Advertisement -