Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 22nd, 2004, 01:39 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default Different between CAST and CONVERT functions

Hi all,

What are the differences between CAST and CONVERT functions in SQL statement specially for SQLSERVER ?

Thanks in advance

John

Reply With Quote
  #2 (permalink)  
Old October 22nd, 2004, 10:18 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

CAST is based on the SQL-92 standard and is preferred over CONVERT

Jaime E. Maccou
Applications Analyst
Reply With Quote
  #3 (permalink)  
Old October 24th, 2004, 12:00 PM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SELECT CONVERT(char(8),GETDATE(),112)

In the above example CONVERT() offers superior functionality to CAST(),CONVERT ()supports a style parameter (the third argument above) that specifies the exact format to use when converting a datetime value to a character string.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CAST or CONVERT in Access owain SQL Language 12 November 28th, 2013 05:56 AM
Specified cast is not valid. abstar BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 31st, 2005 03:00 PM
cast problem vickyj General .NET 6 September 8th, 2004 06:21 AM
Query String Cast or Convert function hoffmann Access 6 February 25th, 2004 01:58 PM



All times are GMT -4. The time now is 03:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.