I have 2 tabels "realtime" and "historic"
Im getting updates on "realtime" and a trigger transferes the data to
"historic" if the some dates change.
I've made an sp that can update "realtime" and "historic", and it is more
efficiant than the trigger. I have several applikations that updates
realtime, wich I do not control, so I can not remove my trigger.
I do not want the updates to happen 2 times.
Is it possible in my sp to skip the trigger and do the historic update
itself ?
Best regards
MikaelMikael
ALTER TABLE ? DISABLE TRIGGER ALL --or trigger's name
"Mikael" <Mikael@.discussions.microsoft.com> wrote in message
news:A6291B4D-1F13-4740-BF9B-A91C554252A6@.microsoft.com...
>I have 2 tabels "realtime" and "historic"
> Im getting updates on "realtime" and a trigger transferes the data to
> "historic" if the some dates change.
> I've made an sp that can update "realtime" and "historic", and it is more
> efficiant than the trigger. I have several applikations that updates
> realtime, wich I do not control, so I can not remove my trigger.
> I do not want the updates to happen 2 times.
> Is it possible in my sp to skip the trigger and do the historic update
> itself ?
>
> --
> Best regards
> Mikael|||"Mikael" <Mikael@.discussions.microsoft.com> wrote in message
news:A6291B4D-1F13-4740-BF9B-A91C554252A6@.microsoft.com...
>I have 2 tabels "realtime" and "historic"
> Im getting updates on "realtime" and a trigger transferes the data to
> "historic" if the some dates change.
> I've made an sp that can update "realtime" and "historic", and it is more
> efficiant than the trigger. I have several applikations that updates
> realtime, wich I do not control, so I can not remove my trigger.
>
Why not move your code from the SP into the trigger?
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||You could drop the trigger, disable the trigger, or simply incorporate the
more efficient logic from your procedure into the trigger.
That trigger is there for a reason, so disabling or dropping it may not be
the best choice.
Anyway, here are the options:
- drop a trigger:
drop trigger <trigger name>
go
- disable a trigger:
alter table <table name>
disable trigger <trigger name>
go
...and don't forget to re-enable it after you're done:
alter table <table name>
enable trigger <trigger name>
go
ML
http://milambda.blogspot.com/|||I want the trigger on the table for the other applikations.
I dont think it is recomenteble to disable the trigger in the sp and then
again enable it ?
Best regards
Mikael
"Uri Dimant" wrote:
> Mikael
> ALTER TABLE ? DISABLE TRIGGER ALL --or trigger's name
>
> "Mikael" <Mikael@.discussions.microsoft.com> wrote in message
> news:A6291B4D-1F13-4740-BF9B-A91C554252A6@.microsoft.com...
>
>|||My execution plan shows me that 99% of the update is spend on getting the
affected rows from the inserted and deleted “tables”.
My table is updates frequently, and even though I suspect the plan to be
mistaken about 99%, I still would like to optimize the performance.
Best regards
Mikael
"David Portas" wrote:
> "Mikael" <Mikael@.discussions.microsoft.com> wrote in message
> news:A6291B4D-1F13-4740-BF9B-A91C554252A6@.microsoft.com...
> Why not move your code from the SP into the trigger?
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
>
Showing posts with label dates. Show all posts
Showing posts with label dates. Show all posts
Monday, March 19, 2012
Wednesday, March 7, 2012
Can BCP Handle Leap Day: 2/29/08 ?
I have a production job that is killing BCP... If I change the dates to
2/28/08, the file processes just fine. Here is the error message ... is
this a known issue? Is there a fix for this?
#@. Row 11366, Column 2: Invalid date format @.#
1/21/08 2/29/08 1 0073210002300 0 3.68 12
#@. Row 24909, Column 2: Invalid date format @.#
1/21/08 2/29/08 4 0073210002300 0 3.68 12
#@. Row 38452, Column 2: Invalid date format @.#
1/21/08 2/29/08 7 0073210002300 0 3.68 12
#@. Row 51995, Column 2: Invalid date format @.#
1/21/08 2/29/08 14 0073210002300 0 3.68 12
#@. Row 65538, Column 2: Invalid date format @.#
Thanks!
Greg,
I am sure that bcp is simply using the SQL Server engine, so I would expect
it to 'know'. When I tested the following file all rows worked.
2/29/08
2/28/08
2/29/2008
2/28/2008
If the date was invalid, you would get the message that you show. I get the
errorw when I include a row with:
2/30/2008
So, one possibility is that your format file (or the format of your file) is
the problem. Are you using a format file or are you depending on tabs and
column order? (The latter is fine when it works, of course, but sometimes
you need a format file to control things more. See:
http://support.microsoft.com/kb/67409 and look "format files" in the SQL
Server Book Online for some examples.)
RLF
"greg may" <gregory_may [at] yahoo [dot] com> wrote in message
news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>I have a production job that is killing BCP... If I change the dates to
>2/28/08, the file processes just fine. Here is the error message ... is
>this a known issue? Is there a fix for this?
> #@. Row 11366, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 1 0073210002300 0 3.68 12
> #@. Row 24909, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 4 0073210002300 0 3.68 12
> #@. Row 38452, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 7 0073210002300 0 3.68 12
> #@. Row 51995, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 14 0073210002300 0 3.68 12
> #@. Row 65538, Column 2: Invalid date format @.#
>
>
> Thanks!
>
|||Thanks Russell for your feedback. I will have to set up some more tests to
track this down further.
We are not using a format file in this case. Its using an implicid
conversion as the table structure and the field lay outs are an exact match
(Using Pipe delimiters) ... this may be part of what is causing the issue?
In this case, the destination table is using a SmallDateTime.
I will see if I can reproduce the problem with only the above conditions.
g.
"Russell Fields" <russellfields@.nomail.com> wrote in message
news:uUKHnIzvHHA.4244@.TK2MSFTNGP04.phx.gbl...
> Greg,
> I am sure that bcp is simply using the SQL Server engine, so I would
> expect it to 'know'. When I tested the following file all rows worked.
> 2/29/08
> 2/28/08
> 2/29/2008
> 2/28/2008
> If the date was invalid, you would get the message that you show. I get
> the errorw when I include a row with:
> 2/30/2008
> So, one possibility is that your format file (or the format of your file)
> is the problem. Are you using a format file or are you depending on tabs
> and column order? (The latter is fine when it works, of course, but
> sometimes you need a format file to control things more. See:
> http://support.microsoft.com/kb/67409 and look "format files" in the SQL
> Server Book Online for some examples.)
> RLF
> "greg may" <gregory_may [at] yahoo [dot] com> wrote in message
> news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>
2/28/08, the file processes just fine. Here is the error message ... is
this a known issue? Is there a fix for this?
#@. Row 11366, Column 2: Invalid date format @.#
1/21/08 2/29/08 1 0073210002300 0 3.68 12
#@. Row 24909, Column 2: Invalid date format @.#
1/21/08 2/29/08 4 0073210002300 0 3.68 12
#@. Row 38452, Column 2: Invalid date format @.#
1/21/08 2/29/08 7 0073210002300 0 3.68 12
#@. Row 51995, Column 2: Invalid date format @.#
1/21/08 2/29/08 14 0073210002300 0 3.68 12
#@. Row 65538, Column 2: Invalid date format @.#
Thanks!
Greg,
I am sure that bcp is simply using the SQL Server engine, so I would expect
it to 'know'. When I tested the following file all rows worked.
2/29/08
2/28/08
2/29/2008
2/28/2008
If the date was invalid, you would get the message that you show. I get the
errorw when I include a row with:
2/30/2008
So, one possibility is that your format file (or the format of your file) is
the problem. Are you using a format file or are you depending on tabs and
column order? (The latter is fine when it works, of course, but sometimes
you need a format file to control things more. See:
http://support.microsoft.com/kb/67409 and look "format files" in the SQL
Server Book Online for some examples.)
RLF
"greg may" <gregory_may [at] yahoo [dot] com> wrote in message
news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>I have a production job that is killing BCP... If I change the dates to
>2/28/08, the file processes just fine. Here is the error message ... is
>this a known issue? Is there a fix for this?
> #@. Row 11366, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 1 0073210002300 0 3.68 12
> #@. Row 24909, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 4 0073210002300 0 3.68 12
> #@. Row 38452, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 7 0073210002300 0 3.68 12
> #@. Row 51995, Column 2: Invalid date format @.#
> 1/21/08 2/29/08 14 0073210002300 0 3.68 12
> #@. Row 65538, Column 2: Invalid date format @.#
>
>
> Thanks!
>
|||Thanks Russell for your feedback. I will have to set up some more tests to
track this down further.
We are not using a format file in this case. Its using an implicid
conversion as the table structure and the field lay outs are an exact match
(Using Pipe delimiters) ... this may be part of what is causing the issue?
In this case, the destination table is using a SmallDateTime.
I will see if I can reproduce the problem with only the above conditions.
g.
"Russell Fields" <russellfields@.nomail.com> wrote in message
news:uUKHnIzvHHA.4244@.TK2MSFTNGP04.phx.gbl...
> Greg,
> I am sure that bcp is simply using the SQL Server engine, so I would
> expect it to 'know'. When I tested the following file all rows worked.
> 2/29/08
> 2/28/08
> 2/29/2008
> 2/28/2008
> If the date was invalid, you would get the message that you show. I get
> the errorw when I include a row with:
> 2/30/2008
> So, one possibility is that your format file (or the format of your file)
> is the problem. Are you using a format file or are you depending on tabs
> and column order? (The latter is fine when it works, of course, but
> sometimes you need a format file to control things more. See:
> http://support.microsoft.com/kb/67409 and look "format files" in the SQL
> Server Book Online for some examples.)
> RLF
> "greg may" <gregory_may [at] yahoo [dot] com> wrote in message
> news:%233wz4JyvHHA.736@.TK2MSFTNGP06.phx.gbl...
>
Subscribe to:
Posts (Atom)