Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a field in sql
Message
 
 
To
19/01/2011 10:22:03
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01496561
Message ID:
01496565
Views:
72
This message has been marked as the solution to the initial question of the thread.
>I'd like to create a new field in an sql statement.
>I use this:
>
>
>SELECT  table1.netto, table1.brutto,;
>(IIF(table1.netto==table1.brutto, table1.netto,0)) as netto2,;
>FROM table1;
>INTO CURSOR table2 READWRITE 
>
>
>My problem:
>I'd like to create the field 'netto2' to be same as the field 'netto'. The field 'netto' is N(8,2).
>If netto and brutto in the first record of table1 is not equal, the netto2 field of table2 becomes N(1,0).
>How can I make it N(8,2) too?

Use CAST function in VFP9 to explicitly specify the new field's type.
SELECT  table1.netto, table1.brutto,;
cast(IIF(table1.netto==table1.brutto, table1.netto,0) as N(8,2)) as netto2 ;
FROM table1;
INTO CURSOR table2 READWRITE
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform