Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Text with HardReturns,How to Paste in MSSQL Edit?

Author  Topic 

richdiaz99
Starting Member

22 Posts

Posted - 2012-10-01 : 11:01:31
I am trying to paste into the SQL 2008 Editor and the paste of the large amount of text stops at the first carriage return.

Any suggestions on getting the text with the hard-returns into the column?

From what I've read so far is to make the field [nvarchar](max)

(Or maybe how to Paste/Store RichText? HTML?)

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-01 : 11:05:14
try pasting it into notepad and then copying and pasting to SSMS editor

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

richdiaz99
Starting Member

22 Posts

Posted - 2012-10-01 : 12:14:09
quote:
Originally posted by visakh16

try pasting it into notepad and then copying and pasting to SSMS editor

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Tried that sir, it did not work :-(
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-01 : 12:21:39
where's the text coming from?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-01 : 12:28:56
Instead of using the editor, use a query window. In the query window, type this:

INSERT INTO YourTableNameHere (colNameHere) VALUES ('Pastethetexthere');
For importing data from a file into a table, there are many other methods - for example, you can use Import/Export Wizard which can be launched by right-clicking on the database name in the object explorer in SSMS and selecting Tasks->Import data
Go to Top of Page

richdiaz99
Starting Member

22 Posts

Posted - 2012-10-01 : 13:46:52
quote:
Originally posted by sunitabeck

Instead of using the editor, use a query window. In the query window, type this:

INSERT INTO YourTableNameHere (colNameHere) VALUES ('Pastethetexthere');



ah, this is close but the single quotes in my text break this. Guess I would have to escape these quotes with a global replace? :-)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-01 : 13:48:00
quote:
Originally posted by richdiaz99

quote:
Originally posted by sunitabeck

Instead of using the editor, use a query window. In the query window, type this:

INSERT INTO YourTableNameHere (colNameHere) VALUES ('Pastethetexthere');



ah, this is close but the single and double quotes in my text break this. Guess I would have to escape these quotes?


you still didnt answer the other question

where are you getting this string from ie source?
why do you need to copy and paste it manually in the first place?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

richdiaz99
Starting Member

22 Posts

Posted - 2012-10-01 : 13:53:59
quote:
answer the other question

where are you getting this string from ie source?
why do you need to copy and paste it manually in the first place?

SQL Server MVP
http://visakhm.blogspot.com/



Sorry,

I am pasting from the current website.
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-01 : 14:31:47
quote:
ah, this is close but the single quotes in my text break this. Guess I would have to escape these quotes with a global replace? :-)
Yes, single quotes can be escaped using another quote. For example:
INSERT INTO YourTableNameHere (colNameHere) VALUES ('Macy''s and Kohl''s are both in the S&P 500');
Go to Top of Page
   

- Advertisement -