Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I convert a data-type with a select statement?
Message
De
25/07/2001 16:22:49
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, États-Unis
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Can I convert a data-type with a select statement?
Divers
Thread ID:
00535349
Message ID:
00535349
Vues:
39
Hi,

In VFP I can combine/convert data types within a select statement like so:
 SELECT "test" + ALLTRIM(STR(myintegerfield)) AS MyField ;
 FROM mytable
If I have three rows and the values of myintegerfield were 1,2,& 3 respectively, the results would be:
test1
test2
test3


In TRANSACT-SQL I have tried CAST and CONVERT to accomplish the same thing but the results always come back as:
test1
test1
test1

SQL Server (7.0) is only converting the numeric field once instead of for each row like VFP does.

How can I make this work in SQL Server?

Thanks,
Guy
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform