Solved

SQL 2008 Stored Procedure Combining 2 Fields

Posted on 2012-04-03
2
284 Views
Last Modified: 2012-08-14
I can't seem to get the correct syntax to covert the date time field (ClientDueDate) to varchar to I can then combine with field 2 (WkDay) to show 04/12/2012 - Wed.  The end result will be populating a gridview in asp.net so if there is an easier way, I am open to suggestions.  Thanks!


DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey)) AS ClientDueDate, 
							 dbo.GetWeekDayNameOfDate(DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey))) AS WkDay

Open in new window

0
Comment
Question by:rcowen00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 37803330
Just convert it to varchar as below:

CONVERT(DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey)), varchar(20), 101) AS ClientDueDate, 
dbo.GetWeekDayNameOfDate(DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey))) AS WkDay

Open in new window

0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 37803372
CONVERT(varchar(30), DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey)), 101) + ' - ' +
                                           dbo.GetWeekDayNameOfDate(DATEADD(minute, - 60, dbo.GetOrderCurrentClientDue(op.OrdersProductKey))) AS [Col_name]
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question