﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Date Format / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 26 May 2013 03:24:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>We ask for table and data so that we can write a T-SQL statement and test it to ensure that what we do is what your require.For reference please read the link in my signature on posting code and data for the best help.</description><pubDate>Wed, 05 Dec 2012 06:39:21 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>[quote][b]Minnu (12/5/2012)[/b][hr]Hi Team,Am using below code to display name and "Date of birth"but Field DOB is not coming in Date format.[b]select @FinalString=(SELECT RTRIM(+ISNULL('Name ','')+'  : ' +ISNULL(+CAST(NAME AS VARCHAR(100))+' ','') +ISNULL(' DOB :'+CAST(DOB AS VARCHAR(100))+' ',''))		FROM ETCOL [/b]i want date format in below format.[b]rtrim(convert(varchar, DOB,107)) + ')' [/b]Can u please help me .....[/quote]If you want it formated like [code="sql"] rtrim(convert(varchar, DOB,107)) [/code] then use it in the select statement?[code="sql"] select @FinalString=(SELECT RTRIM(+ISNULL('Name ','')+'  : ' + ISNULL(+CAST(NAME AS VARCHAR(100))+' ','') + ISNULL(' DOB :'+rtrim(convert(varchar(10), DOB,107)) +' ','')) FROM ETCOL[/code]I prefer to be explicit with my CONVERT(VARCHAR(12), DOB,107), since you are going to get a 30 character varchar variable by default, instead of the 12 character that you need.</description><pubDate>Wed, 05 Dec 2012 06:29:17 GMT</pubDate><dc:creator>DiverKas</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Hi Team,Table and data is normat,in my query am checking whether it is null or not null and am not converting to normal date format.can u please convert it to normal date if it is not null.Please help me.....</description><pubDate>Wed, 05 Dec 2012 06:27:02 GMT</pubDate><dc:creator>Minnu</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>And now some data?</description><pubDate>Wed, 05 Dec 2012 06:11:04 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>CREATE TABLE ETCOL (NAME VARCHAR (50), DOB DATETIME)</description><pubDate>Wed, 05 Dec 2012 06:08:22 GMT</pubDate><dc:creator>Minnu</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Please post the create table definition along with data for the table so what we can build up the string for you.</description><pubDate>Wed, 05 Dec 2012 06:05:58 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>BEGINselect @FinalString =(SELECT RTRIM(+ISNULL('Name','')+'  : ' +ISNULL(+CAST(Name AS VARCHAR(100))+' ','')) FROM ETCOL WHERE RIGHT_TEXT ='Name') +CHAR(10)ENDELSEBEGINselect @FinalString=(SELECT RTRIM(+ISNULL('Name','')+'  : ' +ISNULL(+CAST(Name AS VARCHAR(100))+' ','') +ISNULL(' DOB :'+CAST(DOB AS VARCHAR(100))+' ',''))FROM ETCOL WHERE RIGHT_TEXT ='Name') +CHAR(10)END	----------If the DOB is not null, then i want the date format like : Sep 30, 2012		</description><pubDate>Wed, 05 Dec 2012 06:04:30 GMT</pubDate><dc:creator>Minnu</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Well that converts perfectly.Can you provide the DDL and sample data for table ETCOL along with your full query?</description><pubDate>Wed, 05 Dec 2012 05:35:39 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Date format in DOB Column is : '2012-09-30 00:00:00.000'i want date format in : Sep 30, 2012</description><pubDate>Wed, 05 Dec 2012 05:32:08 GMT</pubDate><dc:creator>Minnu</dc:creator></item><item><title>RE: Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Can you provide some sample data of the format that the DOB is and how it should be formatted</description><pubDate>Wed, 05 Dec 2012 05:29:44 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Date Format</title><link>http://www.sqlservercentral.com/Forums/Topic1392931-391-1.aspx</link><description>Hi Team,Am using below code to display name and "Date of birth"but Field DOB is not coming in Date format.[b]select @FinalString=(SELECT RTRIM(+ISNULL('Name ','')+'  : ' +ISNULL(+CAST(NAME AS VARCHAR(100))+' ','') +ISNULL(' DOB :'+CAST(DOB AS VARCHAR(100))+' ',''))		FROM ETCOL [/b]i want date format in below format.[b]rtrim(convert(varchar, DOB,107)) + ')' [/b]Can u please help me .....</description><pubDate>Wed, 05 Dec 2012 05:18:49 GMT</pubDate><dc:creator>Minnu</dc:creator></item></channel></rss>