Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Statement
I have the following SQL statement to pull in data from a database.
INVMASTER.StockCode and INVMASTER.ShelfLife are both strings. How do I change each field from a string to a number in the SQL code, so that it comes into the spreadsheet as a number instead of a string? SELECT INVMASTER.StockCode, INVMASTER.ShelfLife FROM dbo.INVMASTER INVMASTER |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Statement
Hi TIML,
If you're using SQL Server, you can use the CAST statement: SELECT CAST(INVMASTER.StockCode AS Decimal(19,8)), CAST(INVMASTER.ShelfLife AS Decimal(19,8)) ..... You can use Float, Integer, etc, if you wish. Also look at CONVERT, as it has similar functionality. If you have SQL Server Books Online, that'd be a good place to look. If not, they can be found in MSDN somewhere. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] TIML wrote: I have the following SQL statement to pull in data from a database. INVMASTER.StockCode and INVMASTER.ShelfLife are both strings. How do I change each field from a string to a number in the SQL code, so that it comes into the spreadsheet as a number instead of a string? SELECT INVMASTER.StockCode, INVMASTER.ShelfLife FROM dbo.INVMASTER INVMASTER |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Statement
Hi,
You can use VAL(fieldname) function. -- Regards Haldun Alay To e-mail me, please remove AT and DOT from my e-mail address. "TIML" , iletide şunu yazdı ... I have the following SQL statement to pull in data from a database. INVMASTER.StockCode and INVMASTER.ShelfLife are both strings. How do I change each field from a string to a number in the SQL code, so that it comes into the spreadsheet as a number instead of a string? SELECT INVMASTER.StockCode, INVMASTER.ShelfLife FROM dbo.INVMASTER INVMASTER |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Vlookup, if statement, maybe an and statement | Excel Discussion (Misc queries) | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |