Setting A Specific Time
Aug 13, 1998
I`m developing a library catalog in SQL server with a Cold Fusion front end, and I`m having some trouble with setting due dates for books when they get checked out. Most items in the library are due in a week, a month, etc., so it is easy to calculate the due date. However, we have a number of items that are due at the end of the working day.
So, I need to find a way to calculate "the next 5 PM", no matter what time of day it is, and store it in a datetime field? Any ideas?
Any help would be appreciated.
Thanks,
-Elizabeth S. Thomas
Technical Librarian
MAJIQ, Inc.
ELizabeth_Thomas@majiq.com
View 1 Replies
ADVERTISEMENT
Feb 1, 2007
Hi,
How can I set the provider-specific property? Please let me know whether my code is correct.
For example, I want set provider-specific property set DBPROPSET_SQLSERVERDATASOURCE for memory based bulk copy operation. //Initialize the COM library.
...
//Obtain access to the SQL Native Client OLE DB provider.
hr = CoCreateInstance(...);
InitProperties[0].dwPropertyID = DBPROP_INIT_DATASOURCE;
... InitProperties[1].dwPropertyID = DBPROP_INIT_CATALOG;
...
InitProperties[2].dwPropertyID = DBPROP_AUTH_INTEGRATED;
...
InitProperties[3].dwPropertyID = DBPROP_AUTH_PASSWORD;
...
rgInitPropSet[0].guidPropertySet = DBPROPSET_DBINIT;
rgInitPropSet[0].cProperties = 4;
rgInitPropSet[0].rgProperties = InitProperties;
hr = pIDBInitialize->QueryInterface(IID_IDBProperties,
(void **)&pIDBProperties);
hr = pIDBProperties->SetProperties(1, rgInitPropSet); pIDBProperties->Initialize();
// set provider-specific property
DBPROPSET DbPropSetFL[1];
DBPROP DbPropFL[1]; DbPropFL[0].dwPropertyID = SSPROP_ENABLEFASTLOAD;
DbPropFL[0].vValue.vt = VT_BOOL;
DbPropFL[0].vValue.boolVal = VARIANT_TRUE;
DbPropFL[0].dwOptions = DBPROPOPTIONS_REQUIRED;
DbPropFL[0].colid = DB_NULLID; DbPropSetFL[0].guidPropertySet = DBPROPSET_SQLSERVERDATASOURCE;
DbPropSetFL[0].cProperties = 1;
DbPropSetFL[0].rgProperties = DbPropFL; IDBProperties* pIDBPropertiesFL = NULL;
hr = pIDBInitialize->QueryInterface(IID_IDBProperties,(void **)&pIDBPropertiesFL);
hr = pIDBPropertiesFL->SetProperties(1, DbPropSetFL);
hr = pIDBPropertiesFL->Release();************************************************************
and,in SQL Server 2005 BOL,it mentioned
(ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.ko/dataacc9/html/6e14fefc-4e0b-4847-a833-4cf0abe65d50.htm)Description: To bulk copy,
SSPROP_ENABLEFASTLOAD property is set to VARIANT_TRUE.
With this property set on the data source,
the newly created session allows consumer access
to the IRowsetFastLoad interface.If the property is set to VARIANT_FALSE,
IRowsetFastLoad interface is available through
IOpenRowset::OpenRowset by requesting the
IID_IRowsetFastLoad interface
or by setting SSPROP_IRowsetFastLoad to VARIANT_TRUE.Are there any one who provide a sample of above red-mark's not blues?
View 1 Replies
View Related
Oct 19, 2000
Hi:
I like to know how I may store some user-specific data at the beginning of a session and retrieve the same data later during the session in a SQL command. For those of you familiar with ORACLE, I am trying to mimic the SET_CLIENT_INFO and GET_CLIENT_INFO functions of ORACLE's DBMS_APPLICATION_INFO package on SQL Server.
Any suggestions?
thanks,
Peter
View 1 Replies
View Related
Sep 26, 2005
Hi There,
I want to able to run a batch of sql statments (execute procedures) in SQl Server at a specific time. Just wondering if there is a method for that.
View 5 Replies
View Related
Oct 25, 2005
I have an sql statement that I can run by hand. How do I get a job to run this automatically.
I have tried to create a job and it just failes out every time...
View 3 Replies
View Related
Aug 25, 2006
Hi!I use SQL Server Express 2005 and would like that a trigger is fired automatically at a specific time. I have been developing a game which has a lot of periods with a start date and an end date. Every time a periode is finished the trigger should add new records for the next periode. The dates of the periodes are already setted at the beginning of the game. For example:periode startdate enddate1 23.08.2006, 15:00 24.08.2006, 17:002 24.08 .2006, 17:00 25.08.2006, 08:00and so onCan anyone help me how to do this? Thanks!
View 5 Replies
View Related
Feb 25, 2004
Hi,
We want trace ALL activity on prod
server between 3:00 AM and 3:15 AM
Profiler has stop time option ,but
no start option.
I am looking for example how it could be done
Thank you
Alex
View 5 Replies
View Related
Mar 23, 2007
Ok, please pardon my complete ignorance; but I am extremely SQL challenged. I manage the server right now and I am the closest thing to a DBA at the moment with this server.
Here is the problem. I have a job that runs every hour and until last week it was running without any problems. Now, once a day it hangs, and I end up having to restart sql to get it to be functional again. I guess I could just kill the spid, but regardless, it's fails.
It doesn't happen at the same time each day. I thought it was from the backups doing a SQL backup job, but I eliminated that possibility. I can't find what is causing the problem, because the SQL logs just stop at the time that this happens. It's like some other job/query is running and taking all the sql server resources. But I can never catch it when it's happening and I have no event logs or SQL logs to go on.
Is there any query that I can run to find what happened around the specific time the job failed to run? I just need to find what process did what when this job stopped working.
Again, I apologize if my lack of SQL knowledge is making me ask dumb questions, but I am really lost.
Thanks in advanced!
View 3 Replies
View Related
Feb 18, 2008
I have a program that is automatically ran through a job. The program gets the most recent files that have been uploaded to a server. I would like to be able to query the database to see when the last time this job was ran successfully and set this date as the date to look for files newer than the last successful run date.
Could someone point me in the right direction to what tables this data is stored in on a 2005 SQL Server Database?
View 3 Replies
View Related
Feb 28, 2008
I am wondering if it€™s possible to lock a SQL table for specific amount of time, say 5 min.
There is a particular 'Phone' table on the database that should never get locked. Yet, during the development stages we have noticed that the table gets locked at time. The issue since has been resolved to the best of our ability, but, there is still a vague chance that the table can get locked due to the multiple jobs that query the table, when we go live.
If such a situation occurs, we just want to be able flip the switch that will send the server to the mirror mode and the previously mirrored database to become the principal.
So, I just want to recreate a situation by voluntarily locking the table.
Any help in this regard will be appreciated.
View 6 Replies
View Related
Apr 3, 2015
So I have a job that shows active processes
INSERT INTO Query_results(login_name, total_elapsed_time, total_elapsed_time)
SELECT login_name, total_elapsed_time, total_elapsed_time FROM
sys.dm_exec_sessions
I need to then kill all sessions at 11:59pm then log all those that are killed. This is so I can schedule a job at that time, I have sessions that are blocking my job.
View 2 Replies
View Related
May 28, 2015
In sql 2012 i want to track the blocking details at a specific time is any query to get the data ?
View 6 Replies
View Related
Jul 20, 2005
i am using sqlserver 2000, and i was wondering how do i go aboutsetting the query time out. is there a way to configure the querytimeout for a specific user id?
View 1 Replies
View Related
Aug 25, 2006
Hi,
I want to execute a BAT file using Execute Process task, where I want to select the file path (directory) dynamically using a variable whose value is set at runtime.
In simple terms I want to send a value to the "Executable" property dynamically
Can some one help me on this
View 3 Replies
View Related
May 17, 2008
hi there
i am using .net framework 1.1 with SQL 2000 .
i want the data in table to get deleted automatically after 30 days of inserting data.
so how do i achieve this?
View 4 Replies
View Related
Apr 7, 2015
I have this query
SELECT top 100 Ltrim([text]),objectid,total_rows,total_logical_reads , execution_count
FROM sys.dm_exec_query_stats AS a
CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) AS b
where last_execution_time >= '2015-04-07 10:01:01.01'
ORDER BY execution_count DESC
But the result of execution count is from the first. I want to know it only one day.
View 9 Replies
View Related
May 11, 2015
I have a stored procedure that runs every 5 minutes. I have one block in the procedure that will only run if there are records in a temp table. In addition, I would like this block to run only if the current time is between 0 and 5 minutes past the hour or between 30 and 35 minutes past the hour.
Currently, my block looks like this:
IF OBJECT_ID('tempdb..#tmpClosedPOs') IS NOT NULL
BEGIN
I can get the current minutes of the current time by using:
Select DATEPART(MINUTE,GetDate())
I know that it should be simple, but I'm pretty new at Stored Procedures. How do I alter the IF statement to check for the time and only run the block if it's between the times I stated? I started to DECLARE @Minutes INT, but wasn't sure where to go from there.
View 7 Replies
View Related
Oct 29, 2015
This store procedure will get some executable queries from the select statement, the cursor will fetch each rows to execute the query and insert the queries into table_3 to mark as 'E'. Until 17:00, this store procedure will stop execute the queries and just get the queries from select statement insert into table_3 to mark as 'C'.
I don't know why the outputs in table_3 are quiet different than I think. This store procedure comes out with two exactly same queries and one marked as C and another marked as E.
CREATE PROCEDURE procedure1
AS
DECLARE cursor_1 CURSOR FOR
SELECT
'This is a executable query'
FROM table_1
DECLARE @table_2
[code]....
View 1 Replies
View Related
Aug 8, 2007
Hi,
we work with the Reporting Services of the Itanium Edition of SQL Server 2005. With some reports (only some) we have the problem that
very long time is needed for the processing of the report. I checked the ExecutionLog table in my Reportserver database and detected that
values in the column TimeDataRetrieval (TDR) or pretty slow, but them in the column TimeProcessing (TP) are very high.
Report1: TDR = 8304ms TP = 34377ms .
In other (most) reports the values are completely different
Report2: TDR 8336ms TP = 233ms
Now the most interesting thing: When I execute the same report on our test server which is a xeon machine (same data volume, no user workload)
I get the following results:
Report1: TDR = 5244ms TP = 11731ms
Report2: TDR = 4750ms TP = 163
The differences in TimeDataRetrieval (TDR) should be ok, because the machine is used by over 700 people
and so the response times of the Analysis Server database could differ.
Report1 and 2 do not differ too much in complexity. A few groupings, parameters and so on.
The Itanium machine is a 2 way dual core system with 16 Gigabyte RAM.
The Xeon machine is a 2 way xeon system with 8 Gigabyte RAM (32bit processors).
What is going on there? How could I optimize the TimeProcessing of Report1 on the Itanium machine? Which performance counters or tools should I use to go
deeper finding out where the problem is?
View 2 Replies
View Related
Nov 17, 2015
In C#, I can convert UTC time to a specific timezone using:
TimeZoneInfo localTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
DateTime UTCTime = TimeZoneInfo.ConvertTimeToUtc(localTime, localTimeZone);
Is there any equivalent function in T-SQL (SQL Server 2014 / SQL Azure)?
Specifically, I want to be able to convert a time into UTC before inserting it into a table. Right now I am doing:
INSERT INTO Incident (IncidentDescription, dtOccurred)
VALUES (@IncidentDescription, DATEADD(hour, 8, @dtOccurred))
I don't want to hardcode "8" and I want it to adjust for daylight savings time (DST).Â
Is there any concise solution that does not require me to define SQL functions or have lookup tables? I also don't want to use the difference between GETDATE() and SYSUTCDATETIME(), because the timezone of my server is not my local timezone.
View 5 Replies
View Related
Jun 1, 2015
Need to display current time in below format:
06/01/2015 at 7:00 a PST
(Date at time TimeZone)
View 2 Replies
View Related
Oct 31, 2015
If we want to compare datetime vs a specific time what should we do?
i.e.  startdatetime                     specific time
     2015-10-12 00:03:19:020               16:23:00
I want to compare just time in startdatetime coloum vs a specific time i.e. 16:23 .
I convert startdatetime to (DT_DBTIME) after that i want to calculate just time difference. how can i do it?
i.e i want to calculate this two (DT_DBTIME) columns without any date ==> (16:23:00)-(00:03:19)
View 6 Replies
View Related
Mar 11, 2008
Hello.
I have one dataset with a few parameters.
Each parameter get its available values from the some dataset.
So if I have the main DS whice is:
"select name,age,sex from table1 where age = @age and sex = @sex"
The available values for the parameters "age" and "sex" are those datasets:
"select distinct age from table1" and
"select distinct sex from table1".
The problem is thet the query on table1 takes a lot of time and in this case I need to run her three times.
Is there a way to initialize the parameters values in one query excution and save some time?
Thanks.
View 6 Replies
View Related
Oct 29, 2015
This store procedure will get some executable queries from the select statement, the cursor will fetch each rows to execute the query and insert the queries into table_3 to mark as 'E'. Until 17:00, this store procedure will stop execute the queries and just get the queries from select statement insert into table_3 to mark as 'C'.
I don't know why the outputs in table_3 are quiet different than I think. This store procedure comes out with two exactly same queries and one marked as C and another marked as E.
CREATE PROCEDURE procedure1
AS
DECLARE cursor_1 CURSOR FOR
SELECT
'This is a executable query'
FROM table_1
DECLARE @table_2
DECLARE @stoptime DATETIME = NULL;
[Code] ....
View 8 Replies
View Related
Mar 2, 2005
Hello!
I am using a Ms-Access DS which is accessed by a website's server-side scripts.
What I would like to do is set an existing record's date/time field to null. I have tried to simply alter its value by not including any data within the sharps (##), however that did not work.
How can I accomplish this?
Thank you!
Dave
View 2 Replies
View Related
Feb 8, 2005
Hi,
I've set the Query time-out parameter for my default MSDE instance to 1 sec (through the Enterprise Manager) and since the restart of the server I can't connect it through any client tool.
Does anybody know how to return the default value of Query time-out (600s) without using enterprise manager?
thanx a lot
View 2 Replies
View Related
Aug 6, 2015
At the following MDX code , I want to get the aggregate of measure only for  members that are also in the specified last time (like in examp 01/06/2015) . I tried existing and exists, but without any lack.
WITH MEMBER A AS
(b)+(C)
MEMBER [Measures].[Aggregate] AS
Aggregate(DAYTIME].[Month].&[2013-01-01T00:00:00]:[DAYTIME].[Month].&[2015-06-01T00:00:00],
([Measures].[D])
[Code] ....
View 13 Replies
View Related
Nov 19, 2015
If I just use a simple select statement, I find that I have 8286 records within a specified date range.
If I use the select statement to pull records that were created from 5pm and later and then add it to another select statement with records created before 5pm, I get a different count: 7521 + 756 = 8277
Is there something I am doing incorrectly in the following sql?
DECLARE @startdate date = '03-06-2015'
DECLARE @enddate date = '10-31-2015'
DECLARE @afterTime time = '17:00'
SELECT
General_Count = (SELECT COUNT(*) as General FROM Unidata.CrumsTicket ct
[Code] ....
View 20 Replies
View Related
Dec 11, 2007
How to return time & number format that has set in the regional setting using stored procedure.
Following is my sp for getting current date format from Sql Server.
View 1 Replies
View Related
May 23, 2015
I need to select specific values from all rows where the value of a specific column is "Active"
This part works: SELECT LastName, FirstName, MiddleInit, ClientId FROM dbo.Client
But I want to add: WHERE StatusType = (Active) and how to do this.
View 4 Replies
View Related
Jun 30, 2015
We have a "main" SQL 2014 server who imports XML files using SSIS in a datacenter. In remote sites (which are warehouses), there is an instance of SQL 2014 Express. A merge replication is setup, as every operations done on each site must be "forwared" to the main database, as some XML files are generated as output for an ERP system.
Now, the merge replication replicate all the data to the server on each sites. But a specific site don't need the data of every other sites, only the data relevant to itself (which is the warehouse code). Is there a way to replicate only the data relevant to each individual sites to the subscribers? Or is there a better way than replication to accomplish this?
View 2 Replies
View Related
Oct 10, 2007
I want to ship 500,000 aged transactions each night to an archive table and delete them from their source table in one or more logical units of work (LUW). Each row is approx 60 bytes and there is only one non clustered index on the source table presently.
I'm trying to weigh the pros and cons of 3 alternatives. One of them would basically insert the non-aged rows into tempdb, ship the aged records, truncate the table and then insert the tempdb records back into their source all in the same LUW.
For this alternative, I'd at least like to turn off logging when the records get inserted into tempdb as I dont see any value in logging that part of the activity. Is this possible?
View 4 Replies
View Related
Jan 23, 2007
Hi All,
Could you guys please help me with printing reports invoked thru command line/ URL access to print automatically to specific printers and specific trays and also is it possible to set the specific printer and tray as parameters.
Any suggestions is appreciated
Thanks A lot in advance
e,g :
http://localhost/reportserver?/testreports/employee sales&UserID='ABC'&LName=Lastname='victor'&rs:Command=Render
View 1 Replies
View Related