Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create view RecordYearsTwo as
- select Record.RecordID, RecordValue.Value
- from Record join RecordValue on Record.RecordID = RecordValue.RecordID
- where len(RecordValue.Value) = 4
- and RecordValue.Value like '[16-20][0-9][0-9][0-9]%'
- and RecordValue.Value like '%[16-20][0-9][0-9][0-9]'
- and RecordValue.Value != '26 Mar 1850';
- select * from Record
- join RecordYearsTwo on Record.RecordID = RecordYearsTwo.RecordID
- where cast(RecordYearsTwo.Value as int) >= 1800
- Conversion failed when converting the nvarchar value '26 Mar 1850' to data type int.
- create view RecordYearsTwo as
- select r.RecordID, v.Value
- from Record r
- join (
- select *
- from RecordValue
- where len(Value) = 4
- ) v on r.RecordID = v.RecordID
- where len(v.Value) = 4
- and v.Value like '[16-20][0-9][0-9][0-9]%'
- and v.Value like '%[16-20][0-9][0-9][0-9]'
Add Comment
Please, Sign In to add comment