Wrox Programmer Forums
|
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
 
Old September 21st, 2004, 12:31 AM
Authorized User
 
Join Date: Sep 2004
Posts: 67
Thanks: 1
Thanked 0 Times in 0 Posts
Default SQL Server data types

Hello,

I am using the 'datetime' datatype for a column in one of my databases which seems to write to the database as "2004-09-21T00:00:00".
I was wondering if there is a datatype I could use where I'll still get the date written to the column but without the time rubbish on the end of it?


 
Old September 21st, 2004, 12:46 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

As for as the sql server it is the only one data type for date and time and it depends on your language which you are using to provide the value to the column. So that language only provide it the date value and not time. Like ASP has different functions for date and time so you can provide sql only date value to that columns



Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
 
Old September 21st, 2004, 12:52 AM
Authorized User
 
Join Date: Sep 2004
Posts: 67
Thanks: 1
Thanked 0 Times in 0 Posts
Default

The strange thing is when I view the data in Enterprise Manager (by going Open Table --> Return All Rows) it only displays the date as "21/09/2004" which is exactly how I want it.

But when I run a query in Query Analyzer or query the results using XML that's when I get the "2004-09-21T00:00:00" so I'm a bit confused.

 
Old September 21st, 2004, 01:14 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear when you display the result you only display date instead of both



Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
 
Old September 22nd, 2004, 05:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey spinout,

Use this in your queries to get the format what you are looking for.
Code:
select convert(varchar(10),DATETIME_COLUMN,103)
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 23rd, 2004, 02:27 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You can create a view in which you can select the date column in your specific format and use the view in your application

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Import data from sql server using biztalk server kaushalparik Biztalk 0 July 22nd, 2008 06:16 AM
Data Types Clive Astley Access 1 January 17th, 2006 04:13 PM
Data Types edward2006 Infopath 0 November 7th, 2005 06:06 PM
Data types in SQL SQ SQL Language 4 October 3rd, 2004 02:07 AM
Data Types bph Access VBA 3 January 25th, 2004 05:50 PM





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