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
 General SQL Server Forums
 New to SQL Server Programming
 need help with simple stored proc

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2011-05-03 : 10:08:43
HI in this sp. it is not compiling. what i need to do is pass to the
sp the customerid. then i can use the columns datasource and datasourcecustomerid in the app. the table is small:

table name: Customermappings

Datasource - PK, FK, Char 10, Not Null
DatasourceCustomerid - PK, Char50, Not Null
Customerid- FK, Int, Not Null

here is the sp that is not compiling:

create PROCEDURE [dbo].[GetCustomermappings]
@customerid VARCHAR(50)

AS

BEGIN

SET NOCOUNT ON;

SELECT CustomerId
RTRIM(DataSource) AS DataSource
,RTRIM(DataSourceCustomerId) AS DataSourceCustomerId
FROM CustomerMappings u
INNER JOIN Customermappings c ON c.CustomerId = u.CustomerId
WHERE u.customerid = @Customerid

END


Msg 102, Level 15, State 1, Procedure GetCustomermappings, Line 13
Incorrect syntax near 'DataSource'.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-05-03 : 10:12:04
There is a comma missing after CustomerId


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

- Advertisement -