convert

Sims, John (CDC/CCHP/NCBDDD) (CTR) ayu8 at cdc.gov
Fri Mar 28 09:45:42 CDT 2008


Hi Ivan,

CONVERT is a function provided in SQL Server (Possibly others).  It
works inline and does not change the actual stored data.  This is the
info from SQL Server Books Online:

CAST and CONVERT
Explicitly converts an expression of one data type to another. CAST and
CONVERT provide similar functionality.

Syntax
Using CAST:

CAST ( expression AS data_type ) 

Using CONVERT:

CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

Arguments
expression

Is any valid Microsoft(r) SQL Server(tm) expression. For more
information, see Expressions. 

data_type

Is the target system-supplied data type, including bigint and
sql_variant. User-defined data types cannot be used. For more
information about available data types, see Data Types. 

length

Is an optional parameter of nchar, nvarchar, char, varchar, binary, or
varbinary data types. 

style

Is the style of date format used to convert datetime or smalldatetime
data to character data (nchar, nvarchar, char, varchar, nchar, or
nvarchar data types), or the string format when converting float, real,
money, or smallmoney data to character data (nchar, nvarchar, char,
varchar, nchar, or nvarchar data types).


Example:

SELECT SUBSTRING(title, 1, 30) AS Title, ytd_sales
FROM titles
WHERE CONVERT(char(20), ytd_sales) LIKE '3%'

HTH,

- John Sims

 

> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of Ivan Smahin
> Sent: Friday, March 28, 2008 9:49 AM
> To: Valentina Developers
> Subject: Re[4]: convert
> 
> Hello Danny,
> 
> Friday, March 28, 2008, 3:39:52 PM, you wrote:
> 
> > So there is no other way but changing te table structure?
> 
> But you are trying to apply some convert. Is it not the same?
> Of course you can create another table and load data there.
> 
> 
> --
> Best regards,
> Ivan Smahin
> Senior Software Engineer
> Paradigma Software, Inc
> Valentina - The Ultra-Fast Database
> http://www.valentina-db.com
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 
> 



More information about the Valentina mailing list