|
My question is: I have a stored procedure with temptable and dyanmic SQL. When I execute SP it will execute dynamic SQL and give output. It will generate N no of Columns. I want to store output of SP to temptable. How will I implement? Another thing I have only SQL authentication. So what can I do now? Error: Access to the remote server is denied because no login-mapping exists.
(comments are locked)
|
|
Finally I got an answer. SELECT * INTO #SomeNewTable FROM OPENROWSET('SQLNCLI','Server=.;Database=databasename;Uid=username;pwd=password','EXEC sp_who') This will work only for SQL authentication.
(comments are locked)
|
|
I guess it would be hard for you to sort out this. So try this alternative Cheers. Thanks for your response but I do not need to store only output of sp_who sp but in that I have some other stored procs which contains dynamic SQL with N no of columns in output. sp_who is just for an example.
Dec 09 '11 at 06:54 AM
Champak
(comments are locked)
|
|
Check the Username which you mentioned should exist on server and you are using correct password' if this is not a case then. As per your error message: Username tends to put your login name which you had used to connect sql server and password for the same Username and login name both are same. username is mapped to login name.Password is also correct. Do I Need to have a link server for this query? I am running locally.
Dec 08 '11 at 02:13 PM
Champak
(comments are locked)
|
|
instead of that you should supply your SQL Server login and password
I tried but now it throws me below error message. SELECT * INTO #SomeNewTable FROM OPENROWSET('SQLNCLI10','Server=.;Uid=USERNAME;Password=password','EXEC sp_who') Now I got below error message Login failed for user 'username'. OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Invalid connection string attribute".
Dec 08 '11 at 12:36 PM
Champak
Password should have been Pwd. I've updated my answer. Yours should read as follows...
Dec 09 '11 at 11:16 AM
KenJ
(comments are locked)
|

