kizziebutler
Programmer
I am exporting a lot of data using BCP. I know that some of the fields that I am exporting are in the incorrect format or not valid date. I need to write a function or procedure to check against the date and put the correct date out in the correct format. Please could I ask assistance on this, I was looking at something like this:
CREATE function dbo.DateValid(@DateOut varchar(4), @DateIn char(3))
returns date
AS
BEGIN
declare@ret date getdate()
SET @ret = 0
IF (@Date LIKE 'YYYY/MM/DD HH:MM:SS' or
etc...
) AND
@PostcodeIn LIKE ' '
set@ret = Validdate
RETURN @ret
end
CREATE function dbo.DateValid(@DateOut varchar(4), @DateIn char(3))
returns date
AS
BEGIN
declare@ret date getdate()
SET @ret = 0
IF (@Date LIKE 'YYYY/MM/DD HH:MM:SS' or
etc...
) AND
@PostcodeIn LIKE ' '
set@ret = Validdate
RETURN @ret
end