Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Covnerting the date

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-03-12 : 10:08:13
Where would I put the conversion of date in this stored procedure?

I want the date to be converted when it's entered into the DB and go in as 03/11/2010



ALTER procedure [dbo].[UpdateClaim]


@PIC char(2),
@docPmt char(3),
@LAF char(2),
@DteIn datetime,
@Remarks varchar(255),
@DteToFO datetime,
@DteBack datetime,
@Results char(1)


AS update Data

set
[PIC] = @PIC,
[docPmt] = @docPmt,
[LAF] = @LAF,
[DteIn] = @DteIn,
[Remarks] = @Remarks,
[DteToFO] = @DteToFO,
[DteBack] = @DteBack,
[Results] = @Results,

Where pic=@pic

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-12 : 10:12:01
If the columns DteIn, DteToFO, DteBack in your table are data type DATETIME then no convert should be done.
Convert a datetime value to custom format should only be done in front end for display.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-03-12 : 10:17:11
Yes they are all set to Datetime in SQL. How would I convert this in the front end in .net?

DteIn.Text = rd("DteIn").ToString()
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-12 : 10:50:29
quote:
Originally posted by JJ297

Yes they are all set to Datetime in SQL. How would I convert this in the front end in .net?

DteIn.Text = rd("DteIn").ToString()


you can pass format specifier inside tostring()

see

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -