Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


longtext


longtext

Author
Message
LOVER OF SQL
LOVER OF SQL
Valued Member
Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)

Group: General Forum Members
Points: 62 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-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36302 Visits: 18752
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
Valued Member
Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)

Group: General Forum Members
Points: 62 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
Valued Member
Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)

Group: General Forum Members
Points: 62 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
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2817 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-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45307 Visits: 39934
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
LOVER OF SQL
LOVER OF SQL
Valued Member
Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)Valued Member (62 reputation)

Group: General Forum Members
Points: 62 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-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45307 Visits: 39934
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

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