🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-08-2022 10:38 AM
(3545 views)
Hi All,
I am trying to insert rows in SQL Server DB using SAS SQL Pass through facility.
The below code works fine in SQL but I am not sure what I am missing while I am incorporating it in SAS. Could you please tell me the appropriate changes to be made in SAS.
USE [SDMS] GO INSERT INTO [sur].[FactSurveyTotal] ([SurveySK] ,[TotalTypeNm] ,[TotalSubTypeNm] ,[DOSTotalCnt] ,[EDWTotalCnt] ,[WithNAPct] ,[WithoutNAPct] ) VALUES ( (SELECT SurveySK FROM sur.DimSurvey where SurveyYearNum='2020' AND SurveyTypeNm='Physician') ,'Test Type' , 'Test SubType' ,1 ,2 ,3 ,4 )
With
proc sql; connect to odbc(dsn="XXXXXX" user=XXXX password="XXXXX" ); ( ABOVE SQL CODE ); QUIT;
Am I missing anything or should I modify the sql code in any way ?
Thank you,
Prad
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For a pure pass-through command, you need the SAS SQL EXECUTE statement.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For a pure pass-through command, you need the SAS SQL EXECUTE statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to tell SAS that you want to run the command on the remote.
execute by ODBC
(
ABOVE SQL CODE
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Kurt and Tom.
"Execute" is what I missed. It works fine now.
Thank you both again.