Sql 2008 data type for 2million+ characters

hi

what data type should i use in a procedure , to pass the content of a story having more than 2 millions character.
BeyondBGCMAsked:
Who is Participating?
 
ProjectChampionConnect With a Mentor Commented:
If you're using sp_send_dbmail, then there shouldn't be any problem with the proc per se, because it accepts an nvarchar(max) for its @body parameter.
However it also depends on the code that generates the @body and passes it to the proc.
You should be able to find where the real problem is by checking the data stored in the database first and then any code that gets the data out of the database and passes it to the proc.
0
 
ProjectChampionCommented:
Depending on the encoding type (unicode/non-unicode) you can use nvarchar(max) or varchar(max).
0
 
Lee SavidgeCommented:
nvarchar(max)
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
ProjectChampionCommented:
As mentioned earlier nvarchar is for unicode and varchar is for non-unicode. If you don't expect unicode (e.g. foreign alphabets etc.) then varchar makes better sense as it uses one byte for storing each character, i.e. half the requirement of nvarchar, which makes a huge difference not only in storage requirements, but also in I/O and therefore in performance, especially when dealing with such large character strings.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I agree, varchar(max) or nvarchar(max), having a capacity near to 2GB
0
 
BeyondBGCMAuthor Commented:
i am using this data type only , but when i use this , it truncates the data and shows , half results
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Where exactly do you have this issue?

In ssms you have indeed a cutoff, but the data is there
0
 
ProjectChampionCommented:
How do you know if it's truncated the results? Please note that Management Studio truncates large data for display purposes, but the actual data in the table is probably OK. You should be able to test it using something like:
SELECT LEN(my_col), my_col FROM my_table;
0
 
ProjectChampionCommented:
Hi Angel, : )
I didn't see you've already replied... I'm using my mobile and the connection is not so fast.  

Best Regards.
0
 
BeyondBGCMAuthor Commented:
hi

actually i am using one procedure , where the parameter is of type varchar(max), and i am passing a large string to it from C# application ,  and now i want this passed string to be displayed in a mail ,which is triggered from database.

is this is a problem of database mail , which doesn't accept a long string.
0
All Courses

From novice to tech pro — start learning today.