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.
| Author |
Topic |
|
mld24
Starting Member
3 Posts |
Posted - 2007-01-25 : 09:50:20
|
| Can an update statement only update a part of a field? For example, I want to override the text "Full-Time" with "FT" in a memo field (where each memo in the table is different, but all have the text "Full-Time" in them). Is this possible, and if so, how would the statement be set up? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 09:53:40
|
| update <yourtablenamehere>set <yourcolumnnamehere> = replace(<yourcolumnnamehere>, 'full-time', 'FT')Peter LarssonHelsingborg, Sweden |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 09:54:41
|
| MEMO field? In MS ACCESS maybe.In SQL Server you have the option of VARCHAR/NVARCHAR or TEXT/NTEXT column data types.Peter LarssonHelsingborg, Sweden |
 |
|
|
mld24
Starting Member
3 Posts |
Posted - 2007-01-25 : 10:10:36
|
| Thanks for the statment, though this is the error I receive:Error: -2147217900|Can't Execute SQL: update rpt set rpt.sqlstmt = replace(rpt.sqlstmt, 'Full-Time', 'Regular FT')-->[Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type text is invalid for argument 1 of replace function. The system is web based, and the table definition for the field says the type is memo. Thoughts? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-25 : 15:21:16
|
| Oh, I see... Since you are working with ODBC rather than ADO or OLE DB, you see TEXT columns as MEMO datatype."MEMO" columns are harder to work with. I suggest that you change the datatype to VARCHAR(8000) if you plan to not store larger chunks of text than that.Peter LarssonHelsingborg, Sweden |
 |
|
|
mld24
Starting Member
3 Posts |
Posted - 2007-01-26 : 09:08:54
|
| With the current set up as memo, is there any way to do a replace like that, or is changing the data type the only option? Thanks for all your help by the way! |
 |
|
|
|
|
|
|
|