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
 delete

Author  Topic 

ijack
Starting Member

3 Posts

Posted - 2011-02-07 : 21:06:06
removed

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-02-07 : 22:04:10
Show us what you have so far.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ijack
Starting Member

3 Posts

Posted - 2011-02-07 : 22:24:04
Thoughts??? Here's what I have for the sql #2:

create function get_marital_status
(@pass char(8),@date datetime)
returns table
as
return
select top 1
c.[passport no],
c.[Marital Status],
ch.[Date of Change]
from citizens c
left outer join changes ch
on c.[passport no] = ch.[passport no]
where
c.[passport no]=@pass and
((ch.[Date of Change]<=@date and ch.[Date of Change] is not null) or ch.[Date of Change] is null)
order by
ch.[Date of Change] desc


fmar
Go to Top of Page
   

- Advertisement -