Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SQL Server column assign
Message
 
 
À
13/12/2001 15:26:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00594041
Message ID:
00594069
Vues:
27
This message has been marked as the solution to the initial question of the thread.
>Hi everybody!
>
> is it possible to use macro substitutions in SQL 7 in order to update a column, let me explain a little bit more:
>
> I have a table with next columns:
> Cell,year, W1, W2, W3, W4, W5, ... W52 (W = Week)
>
> And I need to update this columns with a single 'Update' statement but I can't figure out how can achieve this. In foxpro is very ease: using the macro (&) but the most similar function is COL_NAME but it can't be used in this statement.
>
>Any Idea
>
>Best Regards
>

Martin,
In SQL Server 7/2000, you can build a dynamic SQL statement and use the SP_EXECUTE stored produre. Ex.
declare @cSQL nvarchar(4000)

set @cSQL = N'update mytable set W' + convert(nvarchar(2),datepart(wk,getdate()))	+
   N' = somevalue where mytable.pk = somepk'
exec sp_executesql @cSQL
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform