quick easy points

Posted on 2006-05-10
Medium Priority
Last Modified: 2010-03-19
What is wrong with this script?

Why doesn't it work?

How do I do this in sql server?

declare @TradeDate as datetime
select @TradeDate = '03/01/2006'
Question by:kamleshmistry
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 1200 total points
ID: 16653146
declare @TradeDate as datetime
select @TradeDate = CONVERT(DATETIME,'03/01/2006', 103)  --- if it's DD/MM/YYYY
select @TradeDate = CONVERT(DATETIME,'03/01/2006', 101)  --- if it's MM/DD/YYYY
LVL 34

Assisted Solution

by:Brian Crowe
Brian Crowe earned 400 total points
ID: 16653456
DECLARE @TradeDate datetime
SET @TradeDate = '20060301' --assuming mm/dd/yyyy format
LVL 17

Assisted Solution

HuyBD earned 400 total points
ID: 16654538
Other way, try to set date format before

declare @TradeDate as datetime
select @TradeDate = '03/01/2006'

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Microsoft provides a rich set of technologies for High Availability and Disaster Recovery solutions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

593 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