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.
| Author |
Topic |
|
wangyc77
Yak Posting Veteran
65 Posts |
Posted - 2007-02-08 : 20:48:11
|
| SAMPLE DATA HolidayLookupholiday ------------------------------------------------------ 2006-09-22 00:00:002006-10-08 00:00:002006-11-02 00:00:002006-11-22 00:00:002006-12-22 00:00:002007-01-01 00:00:002007-01-07 00:00:002007-02-10 00:00:00I tried this------------------declare @h table (holiday SMALLDATETIME)INSERT @hselect Holiday From HolidayLookupselect * from @h-- something to start withIF ( '2007/1/1' IN ( @h)) PRINT 'OK'-----------------------But it seems that I will get an error at @h the purpose that I used a temperary @h instead of using [select Holiday From HolidayLookup] is to increase performance. Because @h's data will be used many times and I don't want to call [select Holiday From HolidayLookup] everytime I need it .Please help**Jonathan** |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-08 : 22:07:30
|
You still have to do select Holiday from @h. So it makes no difference.-- something to start withIF ( '2007/1/1' IN ( select Holiday from @h))PRINT 'OK' KH |
 |
|
|
|
|
|