Reputation: 257
I need to insert a record using Openquery and return the ID value,createddate as ouput parameter.
for eg. I need to insert using openquery to a remote server the customername and then retun the customer ID value,created date as output parameter. insert statement
insert OPENQUERY(TestServer, 'select CustomerName from dbo.Customers') select 'Testing'
How can we achive this through openquery.
Thanks
Upvotes: 0
Views: 1269
Reputation: 2785
This is the only way I could get it to work...
Insert Into OpenQuery([Servername],'Select colToPopulate From [Server].[Schema].[Table];')
Select 'ValToAdd'
Select *
From OpenQuery([Servername],'Select Ident_Current(''[Server].[Schema].[Table]'')')
SQL was being a punk when trying to use an OUTPUT
clause.
Upvotes: 1