if multiple days were selected it would use a logical or such as weds and tues = (4+8=12) I am trying reverse get the days back. What is the best to do that. Thanks
I have a VB6 application from which I want to create and schedule a jobs. The individual jobs should run once and be deleted when succesfully finished. Almost everything works fine. But enabling the jobschedule won't work. In the sp below I set the @enabled parameter of sp_add_jobschedule to 1 (is also default) which should indicate that the schedule is enabled. How to fix this, or what I am doing wrong? I tried to place an execute sp_update_jobschedule at the end of the sp, but no effect at all.
Hi: in sp_add_jobschedule @freq_type = 8 for weekly @freq_interval = 1 for Sunday.
I need to script to create a job which will run every Sunday 6 pm, to backup one prod database to a new backup device. EX. database name is DBTest, and the 7/20/2003 (Sunday) running result should be backup_DBTest_2003_07_20.bak. and next Sunday's should be backup_DBTest_2003_07_27.bak. (if this way, the backup device will be created at the begining of the job running...)
this way the backup would not be overwritten. Is there a way to dynamically generate 54 weeks job script from this coming Sunday?
Or to make the backup result as backup_DBTest_2003_week27.bak, backup_DBTest_2003_week28.bak....
Hello,I am writing a query to select records added to a table today, in the last 3 days, in the last 7 days, and so on.Here is what I have (which seems that its not working exactly). -- total listed today SELECT COUNT (*) FROM mytable WHERE DATEDIFF(Day, mydatecolumn, getdate() ) <= 0-- total listed yesterday SELECT COUNT (*) FROM mytable WHERE DATEDIFF(Day, mydatecolumn, getdate() ) <= 1-- total listed in the last 3 days SELECT COUNT (*) FROM mytable WHERE DATEDIFF(Day, mydatecolumn, getdate() ) <= 3I'd like to be able to select the count for records added within the last X number of days. Can someone please help me out? Thanks so much in advance.
How would I bring back a column that shows all the days from the begining of the year to the current date. Also make sure this moves onto the next year.
Hey heyI've written my site in asp.net 2 and have set up roles and various logins etc which work beautifully locally. Now, when i upload to my host I get the: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)The thing is, I've checked my connection string a million times and it's perfect, I've also checked all the database settings on my host and they're all fine. However, when i use SQL Server Management Studio Express to copy my database from the local to the remote server (from a tutorial on these forums), I get the "Operation completed successfully" message yet when I expand my tables, there is no data in them. I've tried copying and pasting the data in manually but i still get the same issue. It's driving me absolutely insane! Anyone any ideas?Thanks
Hi all, I have a table in which I have two fields in my DB. FromDate and ToDate. Both are stored as Varchar(MAX). I would like to have an SP which gives me the Days in Between them. Regards, Naveen.
Is there any way to find out in sql server that whether it is Monday to friday or saturday sunday.I have to write a stored procedure in which the logic shoukld be done only if there is a weekend.if saturday or sunday select * from status_tempPlease let me know if there is any function that is available in sql
Hi, I just want to know, is there anything more better solution than this one to find out the no of days in a month ? I have done this but I am not satisfied,anybody has a smarter solution? Plz comment..
My Solution :
/* check leap year*/ if year(getdate())%4<>0 set @noofdays=(select case month(getdate())-1 when 1 then 31 when 2 then 28 when 3 then 31 when 4 then 30 when 5 then 31 when 6 then 30 when 7 then 31 when 8 then 31 when 9 then 30 when 10 then 31 when 11 then 30 when 12 then 31 end ) else set @noofdays=(select case month(getdate())-1 when 1 then 31 when 2 then 29 when 3 then 31 when 4 then 30 when 5 then 31 when 6 then 30 when 7 then 31 when 8 then 31 when 9 then 30 when 10 then 31 when 11 then 30 when 12 then 31 end)
Hi, I used the following query to update my columns according to the change of time and days of the week. But my query is not working as it should. Today is Tuesday and the time now is 9am so according to my query Mon_Night column should be updated but Sat_Night column is being updated when i execute the query. Please advice..
Condition 1. Let's say, the current date is 5/9/2008 2. Result only display the last 7 days data. From above data. it's mean only pickup from 5/3/2008 to 5/9/2008 3. Every Main_ID only pickup the MAX Hit 4. Diff (column on the fly) = Hit - Hit2
Hello, I have a table with a field Expiration of smalldatetime. I want to only display the data that has 60 days or more between Expiration and todays date. Any help would be highly appreciated.
So Im trying to find the number of days in a certain month I know how I want to do but cant figure out how to code it
i want to take the first date of the getadate() and then ad a month then subtract 1 day and ill have the number of days in a month how would i code that?
Hi Everyone,I use the following to get records from the last two days in MySql:where date_entered <= curdate() and date_entered >=DATE_SUB(curdate(),INTERVAL 2 day)I'm looking to do the same in MS-Sql server but I'm just not getting it.I've got this so far which does not work:where hit_date <= GETDATE() and hit_date >= DATE_SUB(GETDATE(),INTERVAL 2day)then I tried this:WHERE hit_date >= DATEDIFF(GETDATE(), (GETDATE()-2)>Essentially, I need all records from the last two days.Any help or guidance in this matter would be greatly appreciated.-JohnyB
I am pretty much brand new to reporting services so I apologize for any simple questions I may ask.
I have created a call report that shows data broken down by day and grouped by week. Everything works great. However, if there is no data on a certain day is does not show me that day on the report. Is there a way I can make it display the day even if there is not data for that day and just give me 0 values? Or do I need to modify my query?
Hello,I am writing a SQL query to count records in a table from the last "X" number of days.There is a dateTime column that I want to base this off of:Lets say.. I want to count the records that were added in the last 3 days. What is the query I should use to get this value?Here is what I have and it seems to not be working correctly:SELECT @TotalListedLast3Days = COUNT (*) FROM myTable WHERE DATEDIFF(Day, DateAdded, getdate() ) <= 3Can someone help so I am able to get the count of records added in the last "X" days?Thank you very much.
Hi, I have a textbox with date selected from calendar... Now i put in another textbox to enters number of day(30 or 120 or other), this number may vary... so my qns is how to add the n numbers of days entered to the date selected? i stored date as smalldatetime Help is appreciated
i have a customer and his output date must be 6 weeks or 42 days after his input date in my sql queryhow do i do this i've don't it in access and tried a similar code to no avail '[inputDate]' + '42' alias ext1 can anyone help me out thanks chris
If I have and invoice date column and I want to now what invoices are 15 days past due or 30 days past due, how do I do this in a where clause? WHERE tblInvoices.InvoiceDate ???