SQL Server Time Zone?

Oct 7, 2006

I don't know what is going on, here's the error message, could someone please answer ? thanks




Server Error in '/' Application.


Procedure or Function 'aspnet_Membership_CreateUser' expects parameter '@TimeZoneAdjustment', which was not supplied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure or Function 'aspnet_Membership_CreateUser' expects parameter '@TimeZoneAdjustment', which was not supplied.

Source Error:





An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:





[SqlException (0x80131904): Procedure or Function 'aspnet_Membership_CreateUser' expects parameter '@TimeZoneAdjustment', which was not supplied.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857482
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735094
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +3612
System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +305
System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453
System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149
System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102





Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

View 10 Replies


ADVERTISEMENT

How To Convert UTC Time (retrieved From SQL) To Local Time In Reporting Services Based On Time Zone

Aug 7, 2007



Hi all,

I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.

I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.

For example if the date is August 07, 2007 10:00 AM UTC,

then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.


Similarly for other Time Zones it should display the time accordingly.

Is this possible in SSRS 2005?

Any pointers will be usefull...

Thanks in advance
sudheer racha.

View 5 Replies View Related

SQL Server 2014 :: How To Add Time Zone To DateTime Field

Jul 4, 2014

I have passed createdDate from UI to Stored procedure.createdDate field declared with DateTime.it is having value 2014-07-01.I need to fetch records from the database based upon the created field.but Create_TM in database having value Date with timestamp.so how would i change the createdfield in stored procedure.

ALTER PROCEDURE [dbo].[ByDateRange]
@Feed VARCHAR(50),
@CreatedDate DATETIME
select * from Date_table where Create_TM = @CreatedDate

View 6 Replies View Related

Time Zone Adjustment In SQL Server 2005 Express

Dec 18, 2005

I am using Visual Web Developer 2005 Express Edition & SQL Server 2005 Express Edition.

In a database that is role-manager-enabled, you will have some tables like apsnet_Users, aspnet_Roles, etc.
And some Columns like CreatedDate, LastLoginDate in the tables.

My problem:
The datatime values in the aforementioned fields are updated based on GMT instead of the client's local time zone.

Is this the way it is?
No matter true or not, how to fix it?

Many Thanks in advance :)

Jey Leong

View 5 Replies View Related

SQL Server Admin 2014 :: Time Zone On Reporting Services?

Oct 6, 2014

I've migrated a server with SQL Server 2008R2 and Reporting services into a new box with SQL Server 2014, but forgot to change the timezone to the correct one. I've changed it later, but it seems like the reports are running by the old default timezone. The schedule says that the report should run at 6:30am, but the Last Run column shows 8:30 PM.

I need to fix it without manually updating each subscription with some date/time conversion.

View 1 Replies View Related

Printing Local Time Zone In Time Format

Nov 16, 2007

I am in need of a format string or simple vb code that can add the local time zone to the end of a time field.. Something like:
9:36 AM EST
9:36 AM PST

This timezone will just come from the machine that the reporting server is on. I don't see this listed as a standard format, and I have come up empty so far in my research - anyone got a solution for this?

Thanks a bunch!

View 4 Replies View Related

TIME ZONE

Jan 19, 2001

Hi
Is their any function available in SQL SERVER like New_function() in Oracle.
This function use to convert time from one Zone to another Zone. i.e Easter time zone to Pacific time Zone.


Thanks and appreciate your Help

JK

View 2 Replies View Related

Finding Time Zone:

May 3, 2007

Finding Time Zone:
Hi,
1. I have a patient record created in the database with a CreateDate
2. I need to find the time zone based on a state or city or zip in the record
3. And find corresponding EST time of CreateDate
 
Is this possible?

View 3 Replies View Related

Convert Time Zone:

May 3, 2007

Convert Time Zone:
I have 05/02/2007 10:00AM CST, how can I convert this to EST in SQL Server 2000 function?

View 3 Replies View Related

Utility To Convert Time Zone

Jan 25, 2008

 Hi All,
Is there any function sql server to convert  datetime zone.
 For example : EMEA follows GMT time zone.
 I want to convert time to other zones which are used by other geos like APAC,IJKK.
Is there any utility on SQL server to do that?
 
Regards
Abdul
 

View 1 Replies View Related

Time Zone Challenge - All Ideas Welcome

Nov 9, 2006

Hi all,

I have been tasked with an interesting challenge and was wondering if any of you experts out there might have any ideas on a solution. Basically, I have a table of packages:

CREATE TABLE [dbo].[tPackage] (
[PkgID] [int] NOT NULL PRIMARY KEY CLUSTERED ,
[PkgDelivZip] [char] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PkgDelivDate] [smalldatetime] NULL ,
[HasBeenDeliv] [bit] NULL
) ON [PRIMARY]
GO

INSERT INTO tPackage VALUES (1, '30022', '11/9/06 10:30 am', 1)
INSERT INTO tPackage VALUES (2, '30022', '11/9/06 10:30 am', 0)
INSERT INTO tPackage VALUES (3, '30022', '11/9/06 06:00 pm', 0)
INSERT INTO tPackage VALUES (4, '96801', '11/9/06 10:30 am', 1)
INSERT INTO tPackage VALUES (5, '96801', '11/9/06 10:30 am', 0)
INSERT INTO tPackage VALUES (6, '96801', '11/9/06 06:00 pm', 0)


And I need to retrieve a list of those packages which are late for delivery. Now if location was not a factor, I could just use the simple script:

SELECT * FROM tPackage WHERE HasBeenDeliv = 0 AND PkgDelivDate < GetDate()

Unfortunately, in the case of package 5, it is not after 10:30am in Hawaii, so this should not be considered late. I thought about having a table of zipcodes with their timezone differential, but the really big problem comes in when you consider the areas which do not observe Daylight Savings Time.

Any thoughts?
Thanks in advance for your feedback!
Cat

View 2 Replies View Related

GETDATE() And The Local Time Zone

Mar 14, 2007

I have used the GETDATE() function within an expression to create a directory name based on the current date. I am in the Sydney time zone and the new day's folder name doesn't change until after 11 am - so GETDATE() is picking up the date and not adjusting for the time zone. How do I either set the time zone within the package or make the GETDATE() function look at time zone of the system on which it is run?

View 3 Replies View Related

Reporting Services :: Insert Row Number For Zone Wise (group By Zone Column) In SSRS Report

Jul 19, 2015

How to insert a row number for a zone wise(ie group by zone column) in ssrs report in zone column  i should get zone1 only once (should not get Zone1,zone1, zone1 -3 times)

sl.no     Zone    District    no.of.region

1                      hyd           24
2          ZONE1 chn           12
3                      bang         2
1                      raj            4
2          ZONE2  vizag       3
3                       bbb         34

View 4 Replies View Related

Adjusting Time Zone And Daylight Saving In SQL

Aug 6, 2007

Hi,
I have this simple SQL query which SELECTs the fields according to the criteria in WHERE clause.  SELECT callingPartyNumber, originalCalledPartyNumber, finalCalledPartyNumber,
dateadd(ss, (dateTimeConnect + (60 * 60 * -5))+3600 , '01-01-1970 00:00:00') AS dateTimeConnect,
dateadd(ss, (dateTimeDisconnect + (60 * 60 * -5))+3600, '01-01-1970 00:00:00') AS dateTimeDisconnect,
CONVERT(char(8), DATEADD(second, duration, '0:00:00'), 108) AS duration
FROM Calls
WHERE
(callingPartyNumber = ISNULL(@callingPartyNumber, callingPartyNumber)) AND
(originalCalledPartyNumber = ISNULL(@originalCalledPartyNumber, originalCalledPartyNumber)) AND
(finalCalledPartyNumber = ISNULL(@finalCalledPartyNumber, finalCalledPartyNumber)) AND
(duration >= @theDuration) AND
((datetimeConnect - 14400) >= ISNULL(convert(bigint,
datediff(ss, '01-01-1970 00:00:00', @dateTimeConnect)), datetimeConnect)) AND
((dateTimeDisconnect - 14400) <= ISNULL(convert(bigint,
datediff(ss, '01-01-1970 00:00:00', @dateTimeDisconnect)), dateTimeDisconnect))
 If you notice, in the SELECT, I add 3600 (1 hour) to adjust the time according to the current DayLight saving setting. Similarly, while comparing in WHERE clause, I subtract 14400 seconds (4 hours) to adjust the comparison according to EST (-5 GMT, but doing -4 GMT since daylight saving) and daylight saving.
Also, dateTimeConnect and dataTimeDisconnect fields save time in UTC seconds.
Now this application may be used by clients in different timezones. The application may be hosted on their server which would mean a different time zone. What would be the best way to make this time zone and daylight adjustment more dynamic instead of hardcoding the values.
 

View 18 Replies View Related

How To Make Aspnet DB Use Local Time Zone?

Mar 12, 2006

I created aspnet DB on SQL Server 2K using aspnet_regsql utility. Everything works fine except the DateTime fields in all tables are using a wrong time zone. How do I set it to use my local time zone?
Any help will be greatly appreciated.

View 1 Replies View Related

How To Display Reports On A Sharepoint Zone Other Than The Default Zone

Aug 7, 2007

Most developers running SharePoint in integrated mode have been experincing issues when displaying SRS reports in a web site other than the default zone.
There is a blog http://www.sharepointblogs.com/nrdev/archive/2007/06/21/ssrs-in-sharepoint-2007-site-using-forms-based-authentication-sharepoint-integrated-mode.aspx that explains that this is a bug and may be fixed when SP3 is released.

We are usi ng dual authentication for a particular site that hosts SRS reports and the default zone is windows auth and the internet zone is FBA. Since we cannot display reports using the RSViewerPage.aspx that comes with RS sharepoint addon, I decided to look for some way to display these reports in a non default zone. This method may help those experincing ths issue but the method assumes that you have one default zone or default zone [0] is the zone where reports are deployed from Visual Studio.

Here are the steps.
1. Go to your Layouts/reportseerver folder in your MOSS installation.
2. make a backup of RSViewerPage.aspx
3. Open RSViewerPage.aspx in visual studio and on the header declarations change the following line that looks like
<%@ Page language="C#" Codebehind="RSViewerPage.aspx.cs" AutoEventWireup="false" Inherits="Microsoft.ReportingServices.SharePoint.UI.RSViewerPage,Microsoft.ReportingServices.SharePoint.UI.ServerPages,Version=9.0.242.0,Culture=neutral,PublicKeyToken=89845dcd8080cc91" %>

to

<%@ Page language="C#" AutoEventWireup="false" %>

4. Add the following script line to the page

<script runat="server">
protected override void OnLoad(EventArgs e)
{
SPSite site = SPContext.Current.Site;
if (!Page.IsPostBack)
{
String RelativeReportUrl = Request["RelativeReportUrl"];
if (site.Zone != SPUrlZone.Default)
{
foreach (SPAlternateUrl url in site.WebApplication.AlternateUrls)
{
if (url.UrlZone == SPUrlZone.Default && RelativeReportUrl != null && url == site.WebApplication.AlternateUrls[0])
{
String path = url.Uri.AbsoluteUri.Substring(0, url.Uri.AbsoluteUri.Length - 1) + RelativeReportUrl;
m_sqlRsWebPart.ReportPath = path;
}
}
}
else
{
m_sqlRsWebPart.ReportPath = site.Url + Request["RelativeReportUrl"];
}
}
//add nav
SiteMapPath map = new SiteMapPath();
map.SiteMapProvider = "SPSiteMapProvider";
map.RenderCurrentNodeAsLink = true;
m_breadCrumbs.Controls.Add(map);
}
</script>

5. This script section just points the web part in the RSviewerPage to the report file hosted in the MOSS default zone.

Thats it.

This should work in either of the MOSS zones.

Gatharia

View 11 Replies View Related

How To Convert Date-field To Date With Time Zone

Jul 4, 2014

I have passed createdDate from UI to Stored procedure.createdDate field declared with DateTime.it is having value 2014-07-01.I need to fetch records from the database based upon the created field.but Create_TM in database having value Date with timestamp.so how would i change the createdfield in stored procedure.

ALTER PROCEDURE [dbo].[ByDateRange]

@Feed VARCHAR(50),

@CreatedDate DATETIME

select * from Date_table where Create_TM = @CreatedDate

View 1 Replies View Related

Insufficient Buffer Zone

Jun 12, 2008

hello again,

This is another pending issue.

It is another package accessing the same database of the same system ("Sage" for commercial and accounting operations).

When run, it gives an error message, as following (also translated from french):
Simba ODBC Driver[CBase]: Very Small/Insufficient Buffer Zone. Data is truncated.

it seems there is a bug in the database, as when we run the same package on another database, it runs successfully.

It may be possible that the database needs a maintenance. Is it possible to advise how to do it, if it is so?
May you help in helping resolve this issue?
thank you in advance.

Leïla
P.S: How is it possible to attach a file?

View 1 Replies View Related

SSRS Not Working Outside The Default Zone

Apr 21, 2008



Hi,

Has anyone else come across the problem that reporting services in SQL 2005 do not work outside of the Sharepoint default zone? Is there a workaround for this issue? I have done a lot of searching into the problem for a solution without success.

Thanks in advance.

View 5 Replies View Related

SSIS With Transaction Accross Different Network Zone

Nov 1, 2007

Hello, all

I have developed a SSIS package using a transaction

1. Users upload excel file to web server(139.223.15.xxx)
2.Excute SSIS package in web server to import excel file to SQL SERVER 2005(139.223.3.xxx)

If web server and SQL server are in the same network zone, the package will work successfully.

However, the two servers are in the different network zone, it encounters an error :

DTS can't enlist OLE DB in distribution transaction. Error Code: 0x8004D00E

How do I set any configurations?

Environment:
Web server:windows 2003 server sp1 ent
SQL server 2005 ent:windows 2003 server sp1 ent
SSIS: isolation level-->read committed

View 1 Replies View Related

SQL Server 2014 :: Gathering Stored Procedure Execution Time In Real Time?

Jun 11, 2015

Is there a way to keep track in real time on how long a stored procedure is running for? So what I want to do is fire off a trace in a stored procedure if that stored procedure is running for over like 5 minutes.

View 5 Replies View Related

SQL Server 2008 :: Displaying Transaction Time Punch Data In A Time Card Form?

Oct 7, 2015

I have a table called employee_punch_record that we use to store employee time clock punches.

The columns are:

employeeid,
punch_timestamp,
punch_type (In / Out),
closed (bit used as status for open or closed pay periods),
ident

Here are some examples of a record:

bkingery62015-10-06 16:59:04.000In0
bkingery72015-10-06 16:59:09.000Out0
bkingery82015-10-06 16:59:13.000In0
bkingery92015-10-06 18:22:44.000Out0
bkingery102015-10-06 18:22:46.000In0
bkingery112015-10-06 18:22:48.000Out0
bkingery122015-10-06 18:22:51.000In0
tfeller52015-10-05 17:00:05.000In0

We are using SQL Server 2008 as our database and use Access as a GUI. I am looking to create a form in Access where employees can access their time card and request changes from management. I want to use the format from the attached screen shot for the form. I pretty much know how to do it all, the only point of complication is trying to figure out the easiest way to get the transaction punch record data on employee_punch_record into a format where I can easily populate the form in the horizontal format you see in the screen shot.

I am not super strong in SQL, but figure I can do it using a formatting table of some sort. quick and easy way to move transaction records into a more horizontally oriented record?

View 0 Replies View Related

Handle Time Zones And Daylight Savings Time In SQL Server

Dec 19, 2006

I wanted to know how we can handle Time Zones and Daylight Savings Time in SQL Server 2000 as well as 2005.

Any pointers would be helpful.

Pranav

View 1 Replies View Related

Time In Sql Server Is Not The Real Time

Apr 18, 2007

Hi,when i create a new user in a .MDF file, the hour of creation in the field "createdate" of table "membership" is exactly 2 hours less than the time of my computer. Probably something to do with different hours between Europe and UK or ...How can i set the creation hour to exact the same hour of my computer?ThanksTartuffe

View 4 Replies View Related

Conversion Of Oracle Date Time To Sql Server Date Time In SSIS

Jun 30, 2007

This is driving me nuts..



I'm trying to extract some data from a table in oracle. The oracle table stores date and time seperately in 2 different columns. I need to merge these two columns and import to sql server database.



I'm struggling with this for a quite a while and I'm not able to get it working.



I tried the oracle query something like this,

SELECT
(TO_CHAR(ASOFDATE,'YYYYMMDD')||' '||TO_CHAR(ASOFTIME,'HH24:MM : SS')||':000') AS ASOFDATE

FROM TBLA

this gives me an output of 20070511 23:06:30:000



the space in MM : SS is intentional here, since without that space it appread as smiley



I'm trying to map this to datetime field in sql server 2005. It keeps failing with this error

The value could not be converted because of a potential loss of data



I'm struck with error for hours now. Any pointers would be helpful.



Thanks

View 3 Replies View Related

SQL Server 2008 :: Loop Through Date Time Records To Find A Match From Multiple Other Date Time Records?

Aug 5, 2015

I'm looking for a way of taking a query which returns a set of date time fields (probable maximum of 20 rows) and looping through each value to see if it exists in a separate table.

E.g.

Query 1

Select ID, Person, ProposedEvent, DayField, TimeField
from MyOptions
where person = 'me'

Table

Select Person, ExistingEvent, DayField, TimeField
from MyTimetable
where person ='me'

Loop through Query 1 and if it finds ANY matching Dayfield AND Timefield in Query/Table 2, return the ProposedEvent (just as a message, the loop could stop there), if no match a message saying all is fine can proceed to process form blah blah.

I'm essentially wanting somebody to select a bunch of events in a form, query 1 then finds all the days and times those events happen and check that none of them exist in the MyTimetable table.

View 5 Replies View Related

Force SQL Server To Recompile Stored Procedures Every Time They Run (SQL Server 7/2000)

Apr 27, 2005

This is a solution for a very specific problem, and it's one that you'll hardly ever use, but it's important to know about that one scenario where it can save your neck. Ordinarily, stored procedures are only recompiled if they're no longer in the procedure cache. But if a stored procedure's execution plan is still in the cache, then SQL Server reuses the compiled storedprocedure and its existing execution plan. This is almost always the best course of action. Almost always, but not always.Sometimes, however, reusing an existing plan doesn't offer the most efficient performance. Imagine, for example, that your stored procedure accepts a parameter that determines the natureof a JOIN operation. The results can vary in a big way, so you wouldn't want your procedure to be locked into an execution plan that might be completely inappropriate for that JOIN. In a highlyspecialized case like this, you might want to force SQL Server to recompile the procedure every time the procedure runs. Doing so comes at a performance cost, but this might be offset by thesavings you gain in not executing the procedure with an awful compiled execution plan. Consider carefully whether to use this approach (or whether to re-engineer the over-design of yourapplication to avoid this situation in the first place). Should you need to instruct SQL Server to recompile each time, add the WITH RECOMPILE directive to the procedure, like this:    CREATE PROCEDURE ProcName        @Param int /* ... other parameters */        WITH RECOMPILE    AS /* ... procedure code follows */
If we omit "WITH RECOMPILE", what will be the consequence? Thanks
 

View 3 Replies View Related

SQL 2012 :: Accurate Sorting Data Each Time With Millions Of Records Without Time Field?

Apr 25, 2014

Sample Table

USE [Testing]
GO
/****** Object: Table [dbo].[Testing] Script Date: 4/25/2014 11:08:18 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] ....

It seems to work fine with one million records.

Each primary key is unique, but the begindate is non-unique, and i guess even if i use datetime2 and add nanoseconds, from what i have read, there is a chance that i could have a duplicate datetime since the date is imported via XML from multiple sources.

View 7 Replies View Related

Integration Services :: Exclude Time In Date Time Variable In SSIS For Loop?

Oct 22, 2015

I am trying to load previous days data at 3 am via a SSIS job.

The Date variable is initiated as DATEADD("dd",-1, GETDATE()) in the for loop.

Now, as this job runs at 3 am, and I set the variable as GETDATE() - 1, it excluded the data from 12 am to 3 am in the resultset as Date is set as YYYY-MM-DD 03:00:00:000 I need this to be set as YYYY-MM-DD 00:00:00:000

How can i do this? 

View 2 Replies View Related

Transact SQL :: Update Time Portion Of DateTime Field With Time Parameter

Oct 3, 2015

I hope to update a DateTime column value with a Time input parameter.  Poor attempt below but it looks like the @ApptTime param is coming in as 10:45:00.0000000 and I might have an existing @SendOnDate as: 2015-10-05 07:00:00.000...I hope to end up with 2015-10-05 10:45:00.000

ALTER PROCEDURE [dbo].[SendEditUPDATE]
@QuePoolID int=null
,@ApptTime time(7)
,@SendOnDate datetime

[code]...

View 14 Replies View Related

It Takes A Long Time To Insert The First Record Each Time When The Program Start

Dec 15, 2006

I am using VS2005 (VB) to develop a PPC WM5.0 Program. And I am using SQLCE 3.0. My PPC Hardware is in 400MHz.

The question is when the program try to insert the first record into sdf database after each time the program started. It takes a long time. Does anyone know why and how can I fix it?

I will load the whole database into a dataset when the program start and do all the "Insert", "Update", "Delete" in this dataset and fill it into database after each action.

        cn.Open()
        sda = New SqlCeDataAdapter(SQL, cn) 'SQL = Select * From Table
        scb = New SqlCeCommandBuilder(sda) 
        sda.Update(dataset)
        cn.Close()

I check the sda.update(), it takes about 0.08s for filling one record into database normally. But:

1. Start the PPC Program

2. Load DB into dataset

3. Create a ONE new record in dataset

4. Fill back to DB

When I take this four steps everytime, the filling time is almost 1s or even more!

Actually, 0.08s is just a normal case. Sometimes, it still takes over 1s to filling back a dataset which only inserted one record when the program is running. (Even all inserted records are exactly the same in data jsut different in the integer key)

 However, when I give up the dataset and using the following code:

            cn.Open()
            Dim cmd As New SqlCeCommand(SQL, cn) ' I have build the insert SQL before (Insert Into Table values(XXXXXXXXXXXXXXX All field)

           cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
            cn.Close()
            StartTime = Environment.TickCount

 I found that it is still the same that the first inserted record takes more time, but just about 0.2s. And the normal insert time is around 0.02s. It is 4 times faster!!!

View 1 Replies View Related

Transact SQL :: Converting 24hrs Time To 12 Hours Time Query Format?

Apr 21, 2015

SELECT 
    CONVERT(VARCHAR(10),attnc_chkin_dt,101) as INDATE,
    CONVERT(VARCHAR(10),attnc_chkin_dt,108) as TimePart
FROM pmt_attendance

o/p
indate   04/18/2015
time part :17:45:00

I need to convert this 17:45:00 to 12 hours date format...

View 8 Replies View Related

Problem With Getdate() In Transaction Takes The Insert Time Instead Of The Commit Time

Nov 12, 2007

Hi,

We need to select rows from the database that have been recently inserted/updated. We have a main primary table (COMMIT_TEST) and a second update table (COMMIT_TEST_UPDATE). The update table contains the primary key and a LAST_UPDATE field which is a datetime (to tell us when an update occurred). Triggers on the primary table are used to populate the update table.

If we insert or update the primary table in a transaction, we would expect that the datetime of the insert/update would be at the commit, however it seems that the insert/update statement is cached and getdate() is executed at the time of the cache instead of the commit. This causes problems as we select rows based on LAST_UPDATE and a commit may occur later but the earlier insert timestamp is saved to the database and we miss that update.

We would like to know if there is anyway to tell the SQL Server to not execute the function getdate() until the commit, or any other way to get the commit to create the correct timestamp.

We are using default isolation level. We have tried using getdate(), current_timestamp and even {fn Now()} with the same results. SQL Queries that reproduce the problem are provided below:


/* Different functions to get current timestamp €“ all have been tested to produce the same results */
/*
SELECT GETDATE()
GO
SELECT CURRENT_TIMESTAMP
GO
SELECT {fn Now()}
GO
*/
/* Use these statements to delete the tables to allow recreate of the tables */
/*
DROP TABLE COMMIT_TEST
DROP TABLE COMMIT_TEST_UPDATE
*/
/* Create a primary table and an UPDATE table to store the date/time when the primary table is modified */
CREATE TABLE dbo.COMMIT_TEST (PKEY int PRIMARY KEY, timestamp) /* ROW_VERSION rowversion */
GO
CREATE TABLE dbo.COMMIT_TEST_UPDATE (PKEY int PRIMARY KEY, LAST_UPDATE datetime, timestamp ) /* ROW_VERSION rowversion */
GO
/* Use these statements to delete the triggers to allow reinsert */
/*
drop trigger LOG_COMMIT_TEST_INSERT
drop trigger LOG_COMMIT_TEST_UPDATE
drop trigger LOG_COMMIT_TEST_DELETE
*/
/* Create insert, update and delete triggers */
create trigger LOG_COMMIT_TEST_INSERT on COMMIT_TEST for INSERT as
begin
declare @time datetime
select @time = getdate()

insert into COMMIT_TEST_UPDATE (PKEY,LAST_UPDATE)
select PKEY, getdate()
from inserted
end
GO
create trigger LOG_COMMIT_TEST_UPDATE on COMMIT_TEST for UPDATE as
begin
declare @time datetime
select @time = getdate()

update COMMIT_TEST_UPDATE
set LAST_UPDATE = getdate()
from COMMIT_TEST_UPDATE, deleted, inserted
where COMMIT_TEST_UPDATE.PKEY = deleted.PKEY
end
GO
/* In our application deletes should never occur so we don€™t log when they get modified we just delete them from the UPDATE table */
create trigger LOG_COMMIT_TEST_DELETE on COMMIT_TEST for DELETE as
begin
if ( select count(*) from deleted ) > 0
begin
delete COMMIT_TEST_UPDATE
from COMMIT_TEST_UPDATE, deleted
where COMMIT_TEST_UPDATE.PKEY = deleted.PKEY
end
end
GO
/* Delete any previous inserted record to avoid errors when inserting */
DELETE COMMIT_TEST WHERE PKEY = 1
GO
/* What is the current date/time */
SELECT GETDATE()
GO
BEGIN TRANSACTION
GO
/* Insert a record into the primary table */
INSERT COMMIT_TEST (PKEY) VALUES (1)
GO
/* Simulate additional processing within this transaction */
WAITFOR DELAY '00:00:10'
GO
/* We expect at this point that the date is written to the database (or at least we need some way for this to happen) */
COMMIT TRANSACTION
GO
/* get the current date to show us what date/time should have been committed to the database */
SELECT GETDATE()
GO
/* Select results from the table €“ we see that the timestamp is 10 seconds older than the commit, in other words it was evaluated at */
/* the insert statement, even though the row could not be read with a SELECT as it was uncommitted */
SELECT * FROM COMMIT_TEST
GO
SELECT * FROM COMMIT_TEST_UPDATE


Any help would be appreciated, we understand we could make changes to the application/database to approximate what we need, but all the solutions have identified suffer from possible performance issues, or could still lead to missing deals (assuming the commit time is larger than some artifical time window).

Regards,

Mark

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved