I have read only access to some SQL Sever 2008 R2 database and I need to copy data from some of its tables to the tables in my database; both databases have the same collation.
The source database uses a lot of columns of text datatype. Can I safely make the target columns in my database of type varchar(MAX) and copy data without any risk (I am using INSERT statements to copy data)?
In other words, can I safely copy string data from column of text type to the column of varchar(MAX)? Both columns use the same collation.
Yes, definitely –
VARCHAR(MAX)is the type you should be using anyway. The underlying implementation of both types is essentially the same (on large enough data, or after a type change from text toVARCHAR(MAX)), if you worry about that.You can even “convert” an existing column of type
TEXTtoVARCHAR(MAX)by means of:This will turn your
TEXTcolumn into aVARCHAR(MAX)column without any data loss.Try it! (on a copy of your existing database first, of course)