Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 07-06-09   #1 (permalink)
AMD Overclocker
 
decompiled's Avatar
 
intel ati

Join Date: Feb 2006
Location: Redsox Nation
Posts: 802

Rep: 92 decompiled is acknowledged by some
Unique Rep: 75
Hardware Reviews: 9
Trader Rating: 4
Default TSQL question.

What's the best way to get a view dynamically depending on the month?

I have 12 views setup, each representing a month. (Jan, Feb, etc)

This is my first attempt but it doesn't seem like the best solution.

Code:
declare @currentdate int
set @currentdate = month(getdate())

IF @currentdate = 1
	select * from dbo.JAN_V
ELSE IF @currentdate = 2
	select * from dbo.FEB_V
ELSE IF @currentdate = 3
	select * from dbo.MAR_V
ELSE IF @currentdate = 4
	select * from dbo.APR_V
ELSE IF @currentdate = 5
	select * from dbo.MAY_V
ELSE IF @currentdate = 6
	select * from dbo.JUN_V
ELSE IF @currentdate = 7
	select * from dbo.JUL_V
ELSE IF @currentdate = 8
	select * from dbo.AUG_V
ELSE IF @currentdate = 9
	select * from dbo.SEPT_V
ELSE IF @currentdate = 10
	select * from dbo.OCT_V
ELSE IF @currentdate = 11
	select * from dbo.NOV_V
ELSE IF @currentdate = 12
	select * from dbo.DEC_V

Thanks a bunch!

System: HAKR
CPU
T6670
Motherboard
Intel PM45
Memory
4/PQI DDR2
Graphics Card
HD4560
Hard Drive
500/Seagate
Sound Card
Realtek HD Audio
OS
Windows 7 x64
Monitor
16.4

Last edited by decompiled : 07-06-09 at 11:04 AM
decompiled is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 06:35 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.11450 seconds with 8 queries