SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


longtext


longtext

Author
Message
LOVER OF SQL
LOVER OF SQL
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 451
Howdy everybody,

I want to keep 11321 character in field on table SQL Server, but varchar(max) is not allow...

It's because i'm doing a database migration MySQL to SQL Server and i need a big field (similar bigtext)
Steve Jones
Steve Jones
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: Administrators
Points: 63454 Visits: 19115
varchar(max) should allow 2GB of space. Are you sure this is what the field is set to? How are you determining the 11kb will not fit?

This works:

create table mytest (mychar varchar(max));

insert into mytest select replicate( cast( 'A' as varchar(max)), 11000);




Note there are issue with implicit conversions. http://stackoverflow.com/questions/9172516/how-to-run-a-more-than-8000-characters-sql-statement-from-a-variable

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
LOVER OF SQL
LOVER OF SQL
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 451
but the problem is openrowset

Msg 103, Level 15, State 1, Line 4
The character string that starts with 'select `ID`,if(`STATUS`='',null,`STATUS`) as `STATUS`,if(`DIGITADOR`='',null,`DIGITADOR`) as `DIGITADOR`,if(`DATA_INCLUSAO`='',nu' is too long. Maximum length is 8000.

is the big problem..
LOVER OF SQL
LOVER OF SQL
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 451
I've this problem: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/7a5c76c5-e6f3-49c7-9c52-95935d7530fd/the-character-string-that-starts-with-is-too-long-maximum-length-is-8000?forum=sqlreportingservices
OCTom
OCTom
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3137 Visits: 4152
Read the info on this page about OPENROWSET:

http://technet.microsoft.com/en-us/library/ms190312.aspx

A little over half way down it describes how it handles data exceeding 8,000 bytes using an XML format file.

Tom
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87242 Visits: 41113
I don't know if it's appropriate here or not but I find that a lot of people use OPENROWSET as a defacto standard for a lot of things where something like OPENQUERY might be much more appropriate especially since OPENQUERY doesn't require "SA" privs like OPENROWSET does.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
LOVER OF SQL
LOVER OF SQL
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 451
Jeff, my problem is maximum size 8... I was tried using SSIS, but it's the same problem... I have a 180 columns and 1 million rows (MySQL).... when I show all columns in varchar (after transformation, data type, etc), I have 13421 character, and the maximum is 8... it's the big problem.
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87242 Visits: 41113
LOVER OF SQL (10/30/2013)
Jeff, my problem is maximum size 8... I was tried using SSIS, but it's the same problem... I have a 180 columns and 1 million rows (MySQL).... when I show all columns in varchar (after transformation, data type, etc), I have 13421 character, and the maximum is 8... it's the big problem.


Even SQL Server has such a display problem (although I don't know why you would want to ever display a million rows on screen). I don't know much about MySQL (for example, I don't even know if MySQL has a VARCHAR(MAX) datatype), but would something like the following do it for you (works in SQL Server and seems to be part of the XML standard).

SELECT  @LongString AS [processing-instruction(LongString)]
FOR XML PATH(''), TYPE;



--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search