May 11, 2015 at 10:01 am
Hi Folks. 1. I am gathering data into one central table from different server using SQLCMD mode in SSMS.
2. I need to schedule this in SQL job. so my first step is to capture Data , in SQL step I put step name, and in type I selected Operating system(CmdExec). But it is failing.
So How to use SQLCMD mode in job step ?
Sagar Sonawane
** Every DBA has his day!!:cool:
May 11, 2015 at 10:14 am
If I'm reading this right, I would change the strategy. there might be additional details why you HAVE to go SQLcmd, but i'll start with my assumption.
instead of stepping out to the command line and running SQLCmd, and trying to wrestle the data back into SQL,
I think it would add a linked server to the same server with the same credentials being used, and insert results into a temp table locally, for further consumption.
SELECT *
--INTO #Results
FROM OPENQUERY( [MyLinkedServer],'SELECT * FROM MyDatabase.dbo.TableName ')
SELECT *
--INTO #Results
FROM [MyLinkedServer].MyDatabase.dbo.TableName
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply