BookmarkSubscribeRSS Feed
Arjun_Singh
Calcite | Level 5

Please do me a favour , I am trying to insert multiple rows in the table in db2 database via sas but i am not able to insert multiple rows at a time.

when i use

insert into table_name (a,b,c)

values('a',2,3);

it works but when i use

insert into table_name

select a,b,c

from table2.

then it is not working.

i am getting the error.

I am using SAS EG 6.0.


5 REPLIES 5
DBailey
Lapis Lazuli | Level 10

I think your syntax might be wrong:

proc sql;

insert into table_name(a,b,c)

select a,b,c from table2;

quit;

Arjun_Singh
Calcite | Level 5

Hi DBailey,

I used the same syntax as you wrote(correct one) but i am getting the error when i am trying to insert multiple rows at a time but not for a single row.

JVarghese
Obsidian | Level 7

try adding the clause values before select clause

Amir
PROC Star

Hi,

If your table structures are the same, have you tried something like the following (untested):

insert into want

select * from have;

Regards,

Amir.

stat_sas
Ammonite | Level 13

It seems variables in table_name and table2 have different attributes. Try Proc contents to make sure both tables have same type of variables.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1171 views
  • 0 likes
  • 5 in conversation