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 November 6th, 2004, 07:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default date formate in alias

I am trying to prepare report on Livelink. I use following query.
problem in the query is that it display time in the date columne, ie.

Date1
------------------------
2004-09-08 00:00:00.000
2004-09-09 00:00:00.000
....

I want that this query should not display time, it only display date.

what change in the following query in the c.VALIDATE AS Date1 column ?


SELECT DISTINCT z.ID, a.VALSTR AS From1, b.VALSTR AS To1, c.VALDATE AS Date1, d.VALSTR AS Num
FROM dbo.ATTRDOCS_17183 z INNER JOIN
                      dbo.ATTRLINK_17183 a ON z.ID = a.ID INNER JOIN
                      dbo.ATTRLINK_17183 b ON z.ID = b.ID INNER JOIN
                      dbo.ATTRLINK_17183 c ON z.ID = c.ID INNER JOIN
                      dbo.ATTRLINK_17183 d ON z.ID = d.ID
WHERE (a.VALSTR =
                          (SELECT DISTINCT valstr
                            FROM AttrLink_17183 m
                            WHERE m.id = z.id AND m.RegionName = 'Attr_16336_15')) AND (b.VALSTR =
                          (SELECT DISTINCT valstr
                            FROM AttrLink_17183 m
                            WHERE m.id = z.id AND m.RegionName = 'Attr_16336_13')) AND (c.VALDATE =
                          (SELECT DISTINCT valdate
                            FROM AttrLink_17183 m
                            WHERE m.id = z.id AND m.RegionName = 'Attr_16336_8')) AND (d.VALSTR =
                          (SELECT DISTINCT valstr
                            FROM AttrLink_17183 m
                            WHERE m.id = z.id AND m.RegionName = 'Attr_16336_10'))


how can use cast clause in the above query with the alias that it should display only date not time ?

cast(datepart(day,appstrdate) as varchar(2))+' '+cast( datename(month,appstrdate) as varchar(3))+' '+cast( datepart(year,appstrdate) as varchar(4))

regards.

Mateen







 
Old November 7th, 2004, 02:58 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

try using convert

c.convert(char(10),VALIDATE,110) AS Date1 column


Jaime E. Maccou
Applications Analyst





Similar Threads
Thread Thread Starter Forum Replies Last Post
unrecognised formate umeshtheone Pro VB 6 4 November 13th, 2007 04:47 PM
Input string not in correct formate sonam VB.NET 2002/2003 Basics 1 July 6th, 2006 11:35 AM
Access alias question badgolfer Access 2 December 15th, 2003 04:47 AM
Access alias question badgolfer VB Databases Basics 1 December 12th, 2003 11:56 PM
The Alias Problem byterbit SQL Language 3 July 3rd, 2003 07:28 PM





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