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
 
amd nvidia

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

Rep: 78 decompiled is acknowledged by some
Unique Rep: 68
Hardware Reviews: 9
Trader Rating: 0
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: Slow Poke
CPU
AMD X2 4400
Motherboard
MSI K8N Diamond +
Memory
3gb TCC5
Graphics Card
eVGA 7900GS
Hard Drive
74gb Raptor + Raid 1 640's
Sound Card
Audigy SE
Power Supply
OCZ 600 ModXstream
Case
Antec 1200
CPU cooling
Stock AMD
GPU cooling
Stock eVGA
OS
Windows 7 FTW Edition
Monitor
Dell 1905FP

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 07:17 AM.


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.07977 seconds with 8 queries