cancel
Showing results for 
Search instead for 
Did you mean: 

How to change column data type from BIGINT to INTEGER.

Former Member
0 Kudos

Hello,

I am looking for the SQL command to change an existing column data type from BIGINT to INTEGER.

Thanks,

Ronen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Ronen,

Try ALTER TABLE SCHEMA.TABLE ALTER (<COLUMN> <COLUMN_TYPE>);

Thanks,

Anooj

Former Member
0 Kudos

Not sure if you can convert BIGINT directly into INTEGER. If so, you might want to convert it first into VARCHAR and then into INTEGER.

Former Member
0 Kudos

Hi Anooj,

I tried the following:

ALTER "EFASHION"."BIGINTTEST" ALTER "COL_BIGINT" INTEGER;

Could not execute 'ALTER "EFASHION"."BIGINTTEST" ALTER "COL_BIGINT" INTEGER'

SAP DBTech JDBC: [257] (at 7): sql syntax error: incorrect syntax near "EFASHION": line 1 col 7 (at pos 7)

?

-Ronen

Former Member
0 Kudos

sorry i missed the table bit initially..

try:

ALTER TABLE "EFASHION"."BIGINTTEST" ALTER (COL_BIGINT INTEGER);

As I said, BigInt to Integer might not be supported. If so, convert it inot VARCHAR and then back into integer.

Former Member
0 Kudos

Hi Ronen

Try below statement.

ALTER TABLE "EFASHION"."BIGINTTEST" ALTER ("COL_BIGINT" INTEGER);

Thanks

Santosh Varada

Former Member
0 Kudos

Thanks, Anooj !

Former Member
0 Kudos

Hi Anooj,

I need to change the datatype from integer to nvarchar so i used the above script which you gave.

ALTER TABLE "R_TEST"."PRO_TRACKING_2" ALTER ("Style" NVARCHAR(10));

But its showing following error

"invalid datatype: cannot allow NVARCHAR type column: Style: line 1 col 46 (at pos 45)"

I tried with VARCHAR Instead of NVARCHAR but still same error.. could you tell me what is the issue with this..

regards,

Mathivanan

Former Member
0 Kudos

This message was moderated.

Emanuel
Advisor
Advisor
0 Kudos

This message was moderated.

Answers (0)