views:

88

answers:

1

I am trying to concatenate a list of IDs into a varchar(max) to pass into an openquery for a bulk update of data.

My question is, is there an easy way to see if a string is beyond the length a varchar(max) can handle aside from comparing it to the number?

I have seen this: http://stackoverflow.com/questions/1761124/how-many-characters-in-varcharmax which specifies the exact length of a varchar(max), but I was hoping for a simpler method than comparing length to a static numeric value.

Please let me know if any more information is needed.

+3  A: 

The max length of varchar(max) is 2GB however openquery only takes 8K according to Books On Line

OPENQUERY (linked_server ,'query') Arguments linked_server Is an identifier representing the name of the linked server.

'query' Is the query string executed in the linked server. The maximum length of the string is 8 KB.

SQLMenace
I hadn't even thought of the max length of the openquery.Thanks a lot for your help!
Phil Vollhardt