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 | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 6th, 2004, 07:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
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







Reply With Quote
  #2 (permalink)  
Old November 7th, 2004, 02:58 AM
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

try using convert

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


Jaime E. Maccou
Applications Analyst
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
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



All times are GMT -4. The time now is 11:34 PM.


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