Are u experiencing any error?Please provide a detail information...this will help us to answer you properly and in less time (:
Moreover, why not you are using stored procedure?
This way of saving the record in the DB is highly in-secure and SQL injection vulnerable.
One problem that you may encounter while inserting the record in 'dd-MM-yyyy' format in SQL Server is may be of type conversion like
Declare @t table(Commencement_Dt Date)
Insert into @t Values ('23-11-2015')
Select * from @t
If you execute this you will encounter the below error
Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.
Here, the value '23-11-2015' is in the format of dd-MM-yyyy.
There are a couple of work around which we will show you
a) Change the Storage type from DATE or DATETIME to VARCHAR
Declare @t table(Commencement_Dt Varchar(12))
Insert into @t Values ('23-11-2015')
Select * from @t
/*
Commencement_Dt
----------------------
23-11-2015
*/
b) Use the Convert/CAST function to convert the storage type.
Case for Date storage type
Declare @t table(Commencement_Dt Date)
Insert into @t Values (CONVERT(date, '23-11-2015', 105))
Select * from @t
/*
Commencement_Dt
----------------------
2015-11-23
*/
Case for DateTime storage type
Declare @t table(Commencement_Dt DateTime)
Insert into @t Values (CONVERT(DateTime, '23-11-2015', 105))
Select * from @t
/*
Commencement_Dt
----------------------
2015-11-23 00:00:00.000
*/
Hope this helps.
However, please be detailed from next time so that it becomes easy for other to understand the problem (:
--
Thanks & Regards,
RNA Team
Raja_89, if this helps please login to Mark As Answer. | Alert Moderator