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.
Author |
Topic |
ppatel112
Starting Member
35 Posts |
Posted - 2013-10-23 : 00:28:11
|
Hi All,I have written a update query but I need to compile it in a stored procedure, I tried various attempts but was unsuccessfull.here is my update query.UPDATE c SET c.comp_primaryuserid = u.user_useridFROM dbo.Company AS c INNER JOIN SAMINC.dbo.ARCUS AS y ON y.IDCUST = c.Comp_IdCust Collate Latin1_General_CI_AS INNER JOIN SAMINC.dbo.ARSAP AS z ON z.CODESLSP = y.CODESLSP1 INNER JOIN dbo.Users AS u ON z.NAMEEMPL = u.User_FirstName + ' ' + u.User_LastName Collate Latin1_General_CI_ASany help would be appreciated. regards,parth |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-10-23 : 00:29:50
|
what is the error message ? KH[spoiler]Time is always against us[/spoiler] |
|
|
ppatel112
Starting Member
35 Posts |
Posted - 2013-10-23 : 00:42:40
|
thanks for the response - I haven't been able to write the correct stored procedure as I haven't written any before |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-23 : 02:03:48
|
procedure will look like thusCREATE PROC UpdatedataASUPDATE c SET c.comp_primaryuserid = u.user_useridFROM dbo.Company AS c INNER JOINSAMINC.dbo.ARCUS AS y ON y.IDCUST = c.Comp_IdCust Collate Latin1_General_CI_AS INNER JOIN SAMINC.dbo.ARSAP AS z ON z.CODESLSP = y.CODESLSP1 INNER JOINdbo.Users AS u ON z.NAMEEMPL = u.User_FirstName + ' ' + u.User_LastName Collate Latin1_General_CI_ASGO ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|