Avatar of hhnetworks
hhnetworks
Flag for United States of America asked on

Dynamic SQL query from Linked Server

I have a query that Im running against a linked server. Due to the 8000 character limit of Openquery, I am using dynamic SQL:
DECLARE @SQL1 VARCHAR(MAX)
SET @SQL1 = '<huge select query>'
EXECUTE (@SQL1) AT LinkedServer

Open in new window

How do I "SELECT * INTO <Table>" on my local server?
SQL

Avatar of undefined
Last Comment
hhnetworks

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ste5an

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
hhnetworks

ASKER
Thanks!  I only have Read Only access to the remote server, so cant use an SP on it.  The INSERT INTO is working.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23