I have a SQL Server 2008 table which contains an external user reference currently stored as a bigint – the userid from the external table. I want to extend this to allow email address, open ID etc to be used as the external identifier. Is it possible to alter the column datatype from bigint to varchar without affecting any of the existing data?
I have a SQL Server 2008 table which contains an external user reference currently
Share
Yes, that should be possible, no problem – as long as you make your
VARCHARfield big enough to hold you BIGINT values 🙂You’d have to use something like this T-SQL:
and that should be it! Since all
BIGINTvalues can be converted into a string, that command should work just fine and without any danger of losing data.