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 |
seekerPoet
Starting Member
4 Posts |
Posted - 2012-09-27 : 11:06:09
|
I am wanting to update a temp table in a sp by the following script:UPDATE #SalesDetailSET DriverName = SELECT DriverName FROM EP_Main.vDriver v INNER JOIN #SalesDetail sd on v.DriverID = sd.DriverIDIt errors out at the select |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-27 : 11:10:33
|
syntax was wrongit should beUPDATE sdSET sd.DriverName = v.DriverName FROM EP_Main.vDriver v INNER JOIN #SalesDetail sd on v.DriverID = sd.DriverID ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
seekerPoet
Starting Member
4 Posts |
Posted - 2012-09-27 : 11:30:28
|
Thank you for such quick response. When I run code against this sp it now errors out saying it can not find EP_Main.vDriver. This is a view so how do you gain data from a view using the script above. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-27 : 11:34:27
|
is EP_Main your schema name? if not only this is enoughUPDATE sdSET sd.DriverName = v.DriverName FROM Driver v INNER JOIN #SalesDetail sd on v.DriverID = sd.DriverID ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
seekerPoet
Starting Member
4 Posts |
Posted - 2012-09-27 : 11:37:01
|
EP_Main is one dbase entity of several |
|
|
seekerPoet
Starting Member
4 Posts |
Posted - 2012-09-27 : 11:48:24
|
solved it. it needed to be EP_Main.dbo.vdriver |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-27 : 11:57:22
|
ok...then that means EP_Main is your database name------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|