Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to create some interactive SQL interface, and I was wondering whether I could simply use varchar to store data, and convert into and from other data types so storing the values wouldn't damage my functionality (I'm trying to let the configurations of my application define procedures as if variables are of their type of choice, but actually I'm gonna store them as varchars and convert them to their desired type upon choice. sql_variant is messy, because it can't store texts, and I want my application to be as general as possible.

Any suggestions?
Posted

1 solution

Anything can be converted to and from strings (whether you would want to do that is another matter).

You can use NVARCHAR(max) which is not limited and supports Unicode. [this requires at least SQL Server 2005]
 
Share this answer
 
Comments
ShacharK 25-Oct-11 1:56am    
I need it because the database that I'm working on has tables with multiple types as possible primary indices, and maybe even multiple. I'm trying to track the changes, if there was simply a row id, and the others would have been unique together life would have been so much easier... but no...
Abhinav S 25-Oct-11 2:00am    
My 5!
Mehdi Gholam 25-Oct-11 2:09am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900