BookmarkSubscribeRSS Feed
dhavalyparikh
Obsidian | Level 7

Two Identical Table one at work lib and another in sql sever - One getting generated thru SAS process @ Work Library and based on that I would like to simply update the SQL Server table. What is the best way to do so ?

 

I have 100+ columns in Work lib table and same in SQL server table. 

 

I have library with SQL Server.

2 REPLIES 2
Reeza
Super User

Upload table to your DB in a temp table. 

Use an UPDATE/MODIFY (depends on DB) statement to update your table based on the temp table. 

 

 

Patrick
Opal | Level 21

I assume identical means "identical in structure" and not "identical data". 

If your target is a database like SQL Server then you want to avoid pulling data from the DB into SAS. For this reason you first load your SAS data into the database (ideally a temporary table) and then execute the Update fully in-database (out of SAS: explicit pass-through SQL with an execute() block).

 

I guess another challenge are these 100+ columns and that you don't want to explicitly type them all in your code. Now that you're on the SQL Server side Google SQL Server forums for solutions to this challenge. If you only need an Update then this discussion might be useful for you.

 

And just another thought:

There are always these challenges with floating point number precision when exchanging data between platforms (=some very small differences due to how they get stored). 

I'm not 100% sure but eventually using bulkload for loading the temp table could get you around this challenge because the data exchange is potentially textual (there are many bl_... options that let you fine tune what's happening). 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 347 views
  • 0 likes
  • 3 in conversation