Help with SQL update statement syntax 
Author Message
 Help with SQL update statement syntax

I am running SQL Server 7 on NT 4.

I have a table called NTABLE

create table NTABLE
(AFIELD char(20),
 BFIELD char(20))

The values of NTABLE are as follows:

AFIELD          BFIELD

AAA             N/A
BBB             N/A
CCC             No

I want to update table NTABLE for column BFIELD.

I want column BFIELD to equal the word "Other" concatenated with the first letter of column AFIELD,
where the value in NTABLE.BFIELD  = "N/A"

I do not want just a "SELECT" statement. I need an "UPDATE" statement to reflect the new values in
NTABLE

So the new values of NTABLE after you give me the proper "UPDATE" STATEMENT are:

AFIELD          BFIELD

AAA             OtherA
BBB             OtherB
CCC             No

TIA,



Fri, 01 Nov 2002 03:00:00 GMT
 Help with SQL update statement syntax

update NTABLE
set BFIELD = "Other" + substring(AFIELD,1,1)
where BFIELD = "N/A"



Quote:
> I am running SQL Server 7 on NT 4.

> I have a table called NTABLE

> create table NTABLE
> (AFIELD char(20),
>  BFIELD char(20))

> The values of NTABLE are as follows:

> AFIELD BFIELD

> AAA N/A
> BBB N/A
> CCC No

> I want to update table NTABLE for column BFIELD.

> I want column BFIELD to equal the word "Other" concatenated with the first

letter of column AFIELD,
Quote:
> where the value in NTABLE.BFIELD  = "N/A"

> I do not want just a "SELECT" statement. I need an "UPDATE" statement to

reflect the new values in

- Show quoted text -

Quote:
> NTABLE

> So the new values of NTABLE after you give me the proper "UPDATE"
STATEMENT are:

> AFIELD BFIELD

> AAA OtherA
> BBB OtherB
> CCC No

> TIA,



Fri, 01 Nov 2002 03:00:00 GMT
 Help with SQL update statement syntax
Am Mon, 15 May 2000 16:13:01 -0400, "Lawrence M. Seldin, CMC, CPC"

Quote:
>I am running SQL Server 7 on NT 4.

>I have a table called NTABLE

>create table NTABLE
>(AFIELD     char(20),
> BFIELD     char(20))

>The values of NTABLE are as follows:

>AFIELD              BFIELD

>AAA         N/A
>BBB         N/A
>CCC         No

>I want to update table NTABLE for column BFIELD.

>I want column BFIELD to equal the word "Other" concatenated with the first letter of column AFIELD,
>where the value in NTABLE.BFIELD  = "N/A"

>I do not want just a "SELECT" statement. I need an "UPDATE" statement to reflect the new values in
>NTABLE

>So the new values of NTABLE after you give me the proper "UPDATE" STATEMENT are:

>AFIELD              BFIELD

>AAA         OtherA
>BBB         OtherB
>CCC         No

I don't know the string manipulation function (I have no Online Books
at home), but the rest should be like this (replace
"string_manipulate" with the proper function):

   update NTABLE
   set BFIELD = 'Other' + string_manipulate(AFIELD, 1)
   where BFIELD  = 'N/A'

Greetings
   Dirk



Fri, 01 Nov 2002 03:00:00 GMT
 Help with SQL update statement syntax
Ronne,

Worked great.

Thanks much....

- Larry

Quote:

>update NTABLE
>set BFIELD = "Other" + substring(AFIELD,1,1)
>where BFIELD = "N/A"



>> I am running SQL Server 7 on NT 4.

>> I have a table called NTABLE

>> create table NTABLE
>> (AFIELD char(20),
>>  BFIELD char(20))

>> The values of NTABLE are as follows:

>> AFIELD BFIELD

>> AAA N/A
>> BBB N/A
>> CCC No

>> I want to update table NTABLE for column BFIELD.

>> I want column BFIELD to equal the word "Other" concatenated with the first
>letter of column AFIELD,
>> where the value in NTABLE.BFIELD  = "N/A"

>> I do not want just a "SELECT" statement. I need an "UPDATE" statement to
>reflect the new values in
>> NTABLE

>> So the new values of NTABLE after you give me the proper "UPDATE"
>STATEMENT are:

>> AFIELD BFIELD

>> AAA OtherA
>> BBB OtherB
>> CCC No

>> TIA,



Fri, 01 Nov 2002 03:00:00 GMT
 Help with SQL update statement syntax
Dirk,

Thanks much....

 - Larry

Quote:

>Am Mon, 15 May 2000 16:13:01 -0400, "Lawrence M. Seldin, CMC, CPC"

>>I am running SQL Server 7 on NT 4.

>>I have a table called NTABLE

>>create table NTABLE
>>(AFIELD char(20),
>> BFIELD char(20))

>>The values of NTABLE are as follows:

>>AFIELD          BFIELD

>>AAA             N/A
>>BBB             N/A
>>CCC             No

>>I want to update table NTABLE for column BFIELD.

>>I want column BFIELD to equal the word "Other" concatenated with the first letter of column AFIELD,
>>where the value in NTABLE.BFIELD  = "N/A"

>>I do not want just a "SELECT" statement. I need an "UPDATE" statement to reflect the new values in
>>NTABLE

>>So the new values of NTABLE after you give me the proper "UPDATE" STATEMENT are:

>>AFIELD          BFIELD

>>AAA             OtherA
>>BBB             OtherB
>>CCC             No

>I don't know the string manipulation function (I have no Online Books
>at home), but the rest should be like this (replace
>"string_manipulate" with the proper function):

>   update NTABLE
>   set BFIELD = 'Other' + string_manipulate(AFIELD, 1)
>   where BFIELD  = 'N/A'

>Greetings
>   Dirk



Fri, 01 Nov 2002 03:00:00 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. SQL Update Statement Syntax Help

2. Need help with Syntax on Update or Insert SQL Statement

3. Update statement syntax -- Please Help!!

4. Need help with a simple SQL statement (syntax)

5. Access 2000 Syntax error SQL Statement help

6. (0x80040E14) Syntax error in UPDATE statement.

7. NEWBIE: easy syntax question with UPDATE statement

8. Syntax error in UPDATE statement while using a Memo field

9. UPDATE statement syntax

10. (0x80040E14) Syntax error in UPDATE statement.

11. Syntax error in UPDATE statement

12. HE: Syntax Error in UPDATE statement


 
Powered by phpBB® Forum Software