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 2005 Forums
 Transact-SQL (2005)
 HELP!!!

Author  Topic 

direrayne
Starting Member

30 Posts

Posted - 2010-08-08 : 12:11:34
I would like to make this query result into a new table.

also i cannot get this to run from a linked server. i have tried placeing the " [server\instance].] before the table names

any ideas?

SELECT dbo.RM00301.SLPRSNID, dbo.RM00301.ADDRESS1, dbo.RM00301.CITY, dbo.RM00301.STATE, dbo.RM00301.ZIP, dbo.RM00301.COUNTRY,
dbo.RM00301.SPRSNSLN, dbo.ICL_Sockeye_FlashReport.LOCNCODE, dbo.ICL_Sockeye_FlashReport.TrxFullPrice,
dbo.ICL_Sockeye_FlashReport.TrxFullCost, dbo.ICL_Sockeye_FlashReport.TrxGrossProfit, dbo.ICL_Sockeye_FlashReport.RMSSalesRepName,
dbo.ICL_Sockeye_FlashReport.Department, dbo.ICL_Sockeye_FlashReport.DOCDATE
FROM dbo.ICL_Sockeye_FlashReport LEFT OUTER JOIN
dbo.RM00301 ON dbo.ICL_Sockeye_FlashReport.RMSSalesRepID = dbo.RM00301.SLPRSNID
WHERE (NOT (dbo.ICL_Sockeye_FlashReport.Department IN ('MISS', 'TEST'))) AND (NOT (dbo.ICL_Sockeye_FlashReport.RMSSalesRepName IN ('101', '999')))
AND (dbo.RM00301.COUNTRY = 'COMM')
and dbo.ICL_Sockeye_FlashReport.LOCNCODE = dbo.RM00301.STATE
and Docdate between '7/01/10' and '7/31/10'

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-08-08 : 12:35:07
create a linked server.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-08-08 : 13:06:47
Once you've set the linked server up you can then do a 4 part reference. In the example , i've added
e.g
select * from from mylinkedserver.master.sys.dm_exec_connections

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

direrayne
Starting Member

30 Posts

Posted - 2010-08-08 : 14:51:46
The server has already been linked.
but it is not working.
how about making a a table out of the results?
i will be able to xfer the table to the linked server.

will a select into statement work?

Go to Top of Page
   

- Advertisement -