convert data type

some time there is need to convert a variable to specific data type

in Microsoft SQL server 2008 R2

Cast : select CAST(2000 as varchar); you indicate the target type

Covert, beside the type you can choose the style of the conversion

select convert (DATE,’11/17/2014′,101); (date is data type, 101 is the date american style )





Published by

Leila Etaati

She has over 10 years’ experience working with SQL server. She was involved in many large-scale projects for big sized companies as SQL server and BI consultant. She worked in Industries including banking financial, power and utility, manufacturing … Leila Etaati, PhD student of Information System department, University of Auckland, MS and BS in computer science. She is a lecturer and trainer in Business intelligence and data base design course in University of Auckland.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>