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
 SUBSTR on a Date Column

Author  Topic 

KevinC
Starting Member

4 Posts

Posted - 2008-08-28 : 14:59:56
SELECT SUBSTR(FYSTART,1,4)
FROM ADUADS01.ADVTBDAT
;
------+---------+---------+---------+---------+---------+---------+---------
T408I SQLCODE = -171, ERROR: THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT 1
OF SUBSTR IS INVALID

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-28 : 15:09:48
That doesn't look like a SQL Server error message. What DB engine are you using?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-28 : 15:21:02
SELECT DATEPART(YEAR, FyStart)
FROM Aduads01.Advtbdat



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

KevinC
Starting Member

4 Posts

Posted - 2008-08-28 : 15:48:23
it's DB2. Thanks for such quick replies!
The 'year' function worked. Thank you so much!!
Go to Top of Page
   

- Advertisement -