How to update a table, using a variable instead of a column name 
Author Message
 How to update a table, using a variable instead of a column name

Hi all.

I have this question how can i update a column but calling
that column not from his name, using a variable :

sample table(catalog):

id      f_name     l_name      phone
------  -------    ----------  -------------
123     Hans       rutherford  345092840
321     Henry      mithc       934903488
234     Hilary     seckh       454059343

right script:
update catalog set f.name = 'Hansolo' where id = 123

the way that im trying to do its this:




this scrip doesn't update my table, i know that i
can't     re-invent the "wheel" or the "black tread"
like some people says insteat, but if any one knows how to
do this in this way or different way, ill be glad ok

Thanks in advance.



Sat, 29 May 2004 06:31:28 GMT
 How to update a table, using a variable instead of a column name

hermann,




do check this link out...

http://www.algonet.se/~sommar/dynamic_sql.html

-oj


Quote:
> Hi all.

> I have this question how can i update a column but calling
> that column not from his name, using a variable :

> sample table(catalog):

> id      f_name     l_name      phone
> ------  -------    ----------  -------------
> 123     Hans       rutherford  345092840
> 321     Henry      mithc       934903488
> 234     Hilary     seckh       454059343

> right script:
> update catalog set f.name = 'Hansolo' where id = 123

> the way that im trying to do its this:




> this scrip doesn't update my table, i know that i
> can't     re-invent the "wheel" or the "black tread"
> like some people says insteat, but if any one knows how to
> do this in this way or different way, ill be glad ok

> Thanks in advance.



Sat, 29 May 2004 06:40:35 GMT
 How to update a table, using a variable instead of a column name
Thanks pal, thats the right thing that i was looking for

thanks...!!!

Quote:
>-----Original Message-----
>hermann,




where id = 123')

>do check this link out...

>http://www.algonet.se/~sommar/dynamic_sql.html

>-oj



>> Hi all.

>> I have this question how can i update a column but
calling
>> that column not from his name, using a variable :

>> sample table(catalog):

>> id      f_name     l_name      phone
>> ------  -------    ----------  -------------
>> 123     Hans       rutherford  345092840
>> 321     Henry      mithc       934903488
>> 234     Hilary     seckh       454059343

>> right script:
>> update catalog set f.name = 'Hansolo' where id = 123

>> the way that im trying to do its this:




>> this scrip doesn't update my table, i know that i
>> can't     re-invent the "wheel" or the "black tread"
>> like some people says insteat, but if any one knows how
to
>> do this in this way or different way, ill be glad ok

>> Thanks in advance.

>.



Sat, 29 May 2004 06:59:10 GMT
 How to update a table, using a variable instead of a column name
you're welcome.

-oj


Quote:
> Thanks pal, thats the right thing that i was looking for

> thanks...!!!
> >-----Original Message-----
> >hermann,




> where id = 123')

> >do check this link out...

> >http://www.algonet.se/~sommar/dynamic_sql.html

> >-oj



> >> Hi all.

> >> I have this question how can i update a column but
> calling
> >> that column not from his name, using a variable :

> >> sample table(catalog):

> >> id      f_name     l_name      phone
> >> ------  -------    ----------  -------------
> >> 123     Hans       rutherford  345092840
> >> 321     Henry      mithc       934903488
> >> 234     Hilary     seckh       454059343

> >> right script:
> >> update catalog set f.name = 'Hansolo' where id = 123

> >> the way that im trying to do its this:




> >> this scrip doesn't update my table, i know that i
> >> can't     re-invent the "wheel" or the "black tread"
> >> like some people says insteat, but if any one knows how
> to
> >> do this in this way or different way, ill be glad ok

> >> Thanks in advance.

> >.



Sat, 29 May 2004 11:35:50 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Using variables instead of table names

2. using a variable as a column name in the set clause of an update statement

3. Cognos Impromptu: Filter using Table.Column instead of just Column

4. need help...Using @TABLE variable instead of #temp tables with dynamic SQL (sp_executesql)

5. Using variable instead of a field name

6. Using char/varchar variable instead of object names when issuing DML commands

7. Using Variables for Field Names using .AddNew and .Update

8. SQL+: Using a variable name for the table name

9. update table with variable for table name

10. Variable column name in UPDATE???

11. Creating Tables using variable as Table Name?

12. Resolution - Re: ADP uses underlying table for UPDATE, INSERT instead of view


 
Powered by phpBB® Forum Software