Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server 2000 text field

Status
Not open for further replies.

katmel98

Programmer
Aug 6, 2002
15
VE
Hi to all. I'm newbie uing Sql Server so I'll make (maybe) a newbie question.

Wich is the better way to put some data into a text field?

Right now I have some commands in a txt file and I want to put this inside the text field, but when I try to copy/paste the lines it doesn't work.

So do you know another way?

Thanks in advance.

Regards.
 
What does your table look like?
What does your txt file look like?
How do you know which row in the table gets what text from the file?

With a little more detail, someone (maybe even me) ought be able to help you.

The general approach I use is to generate a script file that I can run in Query Analyzer.
 
Well the table looks like:

recordID (numeric)
form (varchar 50)
object (varchar 50)
validation (text)

The txt contain some VFP 6 commands. Something like this:

SELECT 0
USE aTable
INSERT INTO aTable (anyfield) VALUES (anyvalue)
USE

This kind of instruction is what I want to put in the Text Field.

Could anybody help me on this?

By the way, thanks for your answer.

Regards.
 
I won't be able to get back to you for a couple of days. Hopefully, someone else can respond sooner.

In general, based on what you have posted, you would use a utility like Query Analyzer and execute a SQL statement that looks something like this:

UPDATE MYTABLE SET VALIDATION = ' <your text goes here> '
WHERE RECORDID = <the record ID number goes here>

The wrinkle is being able to specify the carriage-return, line-feed characters between the individual lines of your text. I don't have any documentation here, so I can't be specific until I get back to the office on Monday.

It would be something like this:

UPDATE MYTABLE SET VALIDATION =
'SELECT 0' + char(13) + char(10) +
'USE aTable' + char(13) + char(10) +
'INSERT INTO aTable (anyfield) VALUES (anyvalue)' + char(13) + char(10) +
'USE'
WHERE RECORDID = <the record ID number goes here>

Hope that helps.
 
Thanks Zathras, for your answer I'll follow your sugestion. Let me check.

Regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top