• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1877
  • Last Modified:

Convert DateTime field to short date

I'm trying to figure out how to accomplish this using SQL Server
Query builder for a local package

convert(varchar,dbo.CMC_CLCL_STATUS.CLST_STS_DTM,101)

I get an error Function agrument count error.
0
DYOUNG1006
Asked:
DYOUNG1006
  • 3
  • 2
1 Solution
 
srafi78Commented:
convert(varchar(10),dbo.CMC_CLCL_STATUS.CLST_STS_DTM,101) for date to be returned in MM/dd/yyyy format
0
 
Daniel ReynoldsSoftware Applications Developer / IntegratorCommented:
The following converts the current date and time and also displays the current datetime in default format.

The one thing you didn't mention was the format of your datafield that you are converting.

Select convert(varchar,getdate(),101), getdate()
0
 
DYOUNG1006Author Commented:
my table and field is
dbo.CMC_CLCL_STATUS.CLST_STS_DTM

I've tried varchar(10), (20), and (30).
In addition I can't use getdate(), or dont believe I can because I need the value in CLST_STS_DTM not the general system date.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
srafi78Commented:
Is this a datetime field? Try converting the column into datetime first
CAST(dbo.CMC_CLCL_STATUS.CLST_STS_DTM as DATETIME)
0
 
DYOUNG1006Author Commented:
yes the field is DateTime

While in my local package
while in Transform Data Task Properties
Destination tab
field CLST_STS_DTM Type show datetime
0
 
srafi78Commented:
Maybe you should try
convert(DateTime,dbo.CMC_CLCL_STATUS.CLST_STS_DTM,101)
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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now