SQL Database update of “char” field

pts.
Tags:
SQL
Hi, I need to update a field (datatype "char") in the SQL database. The field contains a network path, e.g. S:OfficeData... which needs to be changed to e.g. S:DataSheets... I have tried a number of options but ran into problems because of the data type, etc. Thanks!

Answer Wiki

Thanks. We'll let you know when a new response is added.

I update character fields all the time without any problems. What message are you getting?

Code similar to this works for me…

Update table YourTable

Set fldNetworkPath = ‘NewFieldData’
where fldNetworkPath like ‘CurrentFieldData%’

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Stephen09
    Maybe you are having a problem with the length of the field. Char fields are always the same length (the max size of the field), and they pad the leftover bytes with spaces at the end. VarChar fields, however, can vary in length (within the max size of the field) because there is no padding taking place. What is the specific error message you are getting when you try to update?
    15 pointsBadges:
    report
  • Malaikanirr
    You may give exact error msg what you have received so, that i can help you exactly. May be from your question, i have understood that if you use nvarchar and try to update using where condition, then the leading spaces does not give desired true value of your condition. may be give exact error msg.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following