Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table Students
- (
- FirstName nvarchar(50) not NULL,
- LastName nvarchar(50) not NULL,
- MiddleName nvarchar(50) not NULL,
- FullName as LastName + ' ' + left(FirstName, 1) + '.' + left(MiddleName, 1) + '.'
- )
- select FullName
- from Students
- FullName as ... persisted
- create function dbo.tfFullName
- (
- @firstName nvarchar(50),
- @lastName nvarchar(50),
- @middleName nvarchar(50)
- )
- returns table
- as return
- select
- FullName = @lastName + ' ' + left(@firstName, 1) + '.' + left(@middleName, 1) + '.'
- GO
- select f.FullName
- from Students s
- cross apply dbo.tfFullName(s.FirstName, s.LastName, s.MiddleName) f
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement