[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


SQL 2008 Stored Procedure Combining 2 Fields

Posted on 2012-04-03
Medium Priority
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

Question by:rcowen00
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
LVL 23

Expert Comment

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

LVL 70

Accepted Solution

Scott Pletcher earned 2000 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]

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

656 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