Last post Jun 29, 2017 04:03 PM by paindaasp
Jun 29, 2017 08:16 AM|jonnygareth30|LINK
I have created a table in MSSQL without setting my ID Identity Specification to yes before saving the table. Is there a way I can change this after the table has been created? I would like to add this to my ID column so I can set the Identity Increment to
Any assistance would be greatly appreciated.
Jun 29, 2017 01:28 PM|paindaasp|LINK
If you have data in your table you could :
INSERT INTO testTable2
SELECT reqDate, strData
This will copy the rows from testable into testTable2 and increment the IDENTITY column.
If the original table is empty, just add the IDENTITY column...
Jun 29, 2017 02:12 PM|jonnygareth30|LINK
Thank you for your response, that has worked perfectly. Would you also know how i can update rows in my column within sql from NULL to be blank?
Jun 29, 2017 04:03 PM|paindaasp|LINK
I don't normally replace my NULLs with a space. Instead you can convert the NULL into anything you wish in your SELECT statement using IsNULL. For example, if I have a column that is a string (CHAR, NCHAR, VARCHAR, NVARCHAR) type, I can use IsNULL to remove
NULL from being returned. Something like this would work:
SELECT strData, IsNULL(strData, 'aBc') AS notNull
This SQL would produce something like this:
To remove the NULL from being sent you could use IsNULL(strData, '')