Solved

SQL 2008 Stored Procedure Combining 2 Fields

Posted on 2012-04-03
2
276 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
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:
ScottPletcher 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now