on 05-23-2016 7:48 AM
Hi,
I have uploaded data from flat file.One of the column is in Nvarchar. Now i want to do some operations on it.How to change the data type from NVARCHAR to DECIMAL via query? or is there any other way?
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried as below :
ALTER TABLE Table
ALTER (Column Data_Type DEFAULT Default_Value,
Column Data_Type NULL);
Also below one :
ALTER TABLE
You can change the definition of an existing column.
For columns without a default value, you can specify one.
For columns with a default value, you can change the existing value.
The new (or first time) defined default value only affects newly inserted rows.
For columns that do not allow NULL values so far, NULL values can be allowed.
ALTER TABLE Official
ALTER (Overtime INTEGER DEFAULT 7,
Salary VARCHAR(3) DEFAULT 'A01',
Name VARCHAR(20) NULL);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
if the solutions offered above do not fit, have a look at the TO_DECIMAL conversion:TO_DECIMAL - SAP HANA SQL and System Views Reference - SAP Library
Kind regards
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
You can alter the data type of column in table, check HANA Changing the type of a column | SCN, https://help.sap.com/saphelp_hanaplatform/helpdata/en/20/d329a6751910149d5fdbc4800f92ff/content.htm.
Regards,
Shireesha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Below are the restrictions in changing the column definitions:
For more details, please refer to link.
Regards
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Can you try the below,
ALTER TABLE schema.table ALTER (column_name decimal(?,?))
Regards,
Nithin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.