-
substringing declared varables in SQL Server
I need to be able to update a row of data in a table based upon the first character of a char(50) field.
if char(1) of employee_Job_class = "X" then update field Class_description = "Temporary"
Anyone have any suggestions ??
-
substringing declared varables in SQL Server (reply)
like this?:
update <table>
set Class_description = 'Temp'
where substring(employee_Job_class ,1,1) = 'X'
...?
------------
Tom Arrowood at 5/20/99 8:45:43 AM
I need to be able to update a row of data in a table based upon the first character of a char(50) field.
if char(1) of employee_Job_class = "X" then update field Class_description = "Temporary"
Anyone have any suggestions ??
-
substringing declared varables in SQL Server (reply)
UPDATE TABLENAME
SET Class_description = CASE CONVERT(CHAR(1), employee_Job_class)
WHEN "X" THEN "Temporary"
ELSE Class_description
This will update all records, "X" records will be have Class_description changed to "Temporary", the rest will have
Class_description updated to Class_description.
Jarlath
------------
Tom Arrowood at 5/20/99 8:45:43 AM
I need to be able to update a row of data in a table based upon the first character of a char(50) field.
if char(1) of employee_Job_class = "X" then update field Class_description = "Temporary"
Anyone have any suggestions ??
-
substringing declared varables in SQL Server (reply)
set Firstrst = db.openrecordset("select employee_job_class, Class_description from tbl?????(s)"
with firstrst
.movefirst
do while .eof = false
FirstChar = left(!employee_job_class, 1)
if firstchar = "X" then
!Class_description = = "Temporary"
end if
.movenext
loop
end with
end sub
something like that should work.... or else link to access and run an update query on the table....
good luck
kim
------------
Tom Arrowood at 5/20/99 8:45:43 AM
I need to be able to update a row of data in a table based upon the first character of a char(50) field.
if char(1) of employee_Job_class = "X" then update field Class_description = "Temporary"
Anyone have any suggestions ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|