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
 Urgent help needed to create a query

Author  Topic 

SQLDBUSER1804
Starting Member

1 Post

Posted - 2014-01-04 : 02:30:29
Hi All,

I am new to SQL server world. Please help me in my following query

I have 3 tables File_List, File_Dest and File_Schedule in SQL server.

File_List Contains following Columns
File_ID (Unique_ID), File_Status (Active/Passive), Customer_Name, Direction (I/O), First_Directory, Original_FileName.

File_Dest contains following columns:
File_ID, File_Dest_ID (Unique_ID), Final_Directory, Output_FileName, Delivery_Type,

File_Schedule contains
File_Schedule_ID (Unique_ID), File_ID, Start_Date, First_Notify(Y/N), Second_Notify(Y/N), Due_Day and Schedule_Type

Due_Day can be Wednesday, Tuesday, Thursday, Sunday, Second Wednesday, Second Monday, Saturday, Monday, Last Monday, Last Day-1, Last Day, Friday, First Wednesday, First Sunday, First Monday, First Day, etc.

Schedule_Type can be Weekly, Weekdays, Variable, Qtr Third Month, Qtr First Month, Number Per Week, Number Per Month, Number Per Day, Every 28 Days, Day(s) In Month(s), Day(s) EachMonth, Day(s) Each Week, Day(s) Each Month, Daily/Hourly, Daily, Bi-Weekly, Bi-Monthly, etc.

Now I need to find today’s scheduled files with all the columns from all three tables. Please help me to create a query which can perform above task.

Thanks,
Khanin

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-04 : 05:20:22
Its not straightforward with the way you're storing the values. Can you atleast provide us valid combinations of values for Due_day and Schedule_type column combo. ex I see Last day-1 etc in Due_day. does that mean LastDay of week,month,quarter ,year etc? Or do you mean all combinations based all values in both columns?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -