ALTER procedure [dbo].[sp_pubhol]
declare @i int
declare @NewDate date
set @i = 0
IF DATEPART(dw, DATEADD(day,@i,CONVERT(date,GETDATE()))) = 7 OR DATEPART(dw, DATEADD(day,@i,CONVERT(date,GETDATE()))) = 1
select Holiday_Name from Holiday where Holiday_On = DATEADD(day,@i,CONVERT(date,GETDATE()))
SELECT @NewDate = DATEADD(DAY,@i,CONVERT(date,GETDATE()))
select @i = @i+1
my task is if today is neither weekend nor public holiday ,i have to that date, increment loop...i have retrieve all the 3 working days...can anyone help me pls
if i want declare @NewDate as array[ ,how to declare that..pls help me
alter procedure sp_pubhol as begin select Holiday_Name from Holiday where Holiday_On = CONVERT(date,GETDATE()) end when i execute sp_pubhol , i am facing the following issue... Invalid object name 'Holiday' pls suggest me what should i do
can anyone help me in writing stored procedure to Activate reminder for event to send email notification 3 days before event along with event description pls .i am using sqlserver2008R2.the list of events are in DB.
What have you tried so far? Where are you stuck and need help?
Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.
The amount of 0 items will make a problem with Mycroft Holmes' answer - that line won't show up.
You need the numbers from 0-23 (somehow generated, or make a table "Hours" with those values, and then JOIN the query suggested by Mycroft Holmes to it, and replace NULL values with 0.
I have visits table for my patients database. I have created_date field which is timestamp with CURRENT_TIMESTAMP and closed_date with datetime datatypes. I have no problem with the created_date but when I close the file using this command:
Not sure how created_date is equal to closed_date.
Make sure, that when you create a patient, at that time populate the created_date field (not closed_date - keep it blank)
At the time of closing the patient, just update the closed_date for that patient, something like:
UPDATE visits SET closed_date = GETDATE() WHERE visit_id = param_visit_id;
I've got a scripted install for the database on a local tablet. The OS is windows 7, and it's sql 2008. I end up with this error:
Error: 18456, Severity: 14, State: 11.
Login failed for user 'FOO\BAR'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: <local machine="">]
I've only got one user account on the machine, and it is an administrator. The best solution I can find so far is "run ssms as administrator", which is not really a valid option. The DB is used by an application only, and we don't even have ssms. I just need the app to be able to use the database. I don't understand why it can't. This same installer has worked on the other machines before this one.
I have followed up more on this being a UAC issue. I actually was going to shut off the notifications with the EnableLUA setting in the registry... but that has already been done. I think that rules out the account not having permissions issue.
If it moves, compile it
modified 2-Mar-13 7:02am.
Last Visit: 25-Feb-20 0:41 Last Update: 25-Feb-20 0:41