Showing posts with label updating. Show all posts
Showing posts with label updating. Show all posts

Monday, March 26, 2012

Finding and updating all rows with the same value in a column

This integer column should be unique, s? prior to altering it to unique i
need to traverse all rows and update the rows with the same value. This tabl
e
has another colun which is the primary key and when 2 rows has the same valu
e
the row with the highest value of the primary key will be updated.
Any easy T-SQL way to do it?
Regards,
Olavupdate your_table
set your_column = whatever you wish to set it to
where exists(select 1 from your_table yt
where your_table.your_column = yt.your_column
and your_table.PK_column > yt.PK_column)
Just curious: what kind of information do you have in that column so
that you can easily update it just to enforse uniqueness?sql

Monday, March 12, 2012

find out tirggers in a DB

Hi,
I've a DB not designed by me. I found that there is a trigger updating
table B when I update table A. I want to disable this trigger but I
don't know the name. Can someone help me? Thanks.Hi
Hope you using sql 2000
SELECT
name,
status = CASE WHEN OBJECTPROPERTY (id, 'ExecIsTriggerDisabled') = 0
THEN 'Enabled' ELSE 'Disabled' END,
Table_name = OBJECT_NAME (parent_obj)
FROM
sysobjects
WHERE
type = 'TR'
the above select returns all the triggers in the database.
then use the ALTER TABLE to disable the trigger
--
VT
Knowledge is power, share it...
http://oneplace4sql.blogspot.com/
"klonic" <jaume.pf@.gmail.com> wrote in message
news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
> Hi,
> I've a DB not designed by me. I found that there is a trigger updating
> table B when I update table A. I want to disable this trigger but I
> don't know the name. Can someone help me? Thanks.
>|||See if this helps you
http://dimantdatabasesolutions.blogspot.com/2007/04/has-table-trigger.html
"klonic" <jaume.pf@.gmail.com> wrote in message
news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
> Hi,
> I've a DB not designed by me. I found that there is a trigger updating
> table B when I update table A. I want to disable this trigger but I
> don't know the name. Can someone help me? Thanks.
>|||Thanks for your help. I found the trigger I was looking for!!! It's
possible to know the code of the trigger?
On Jun 7, 10:04 am, "vt" <vinu.t.1...@.gmail.com> wrote:
> Hi
> Hope you using sql 2000
> SELECT
> name,
> status = CASE WHEN OBJECTPROPERTY (id, 'ExecIsTriggerDisabled') = 0
> THEN 'Enabled' ELSE 'Disabled' END,
> Table_name = OBJECT_NAME (parent_obj)
> FROM
> sysobjects
> WHERE
> type = 'TR'
> the above select returns all the triggers in the database.
> then use the ALTER TABLE to disable the trigger
> --
> VT
> Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic" <jaume...@.gmail.com> wrote in message
> news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
>
> > Hi,
> > I've a DB not designed by me. I found that there is a trigger updating
> > table B when I update table A. I want to disable this trigger but I
> > don't know the name. Can someone help me? Thanks.- Hide quoted text -
> - Show quoted text -|||Hi
sp_helptext triggername
See bol for more info
regards
VT
Knowledge is power, share it...
http://oneplace4sql.blogspot.com/
"klonic" <jaume.pf@.gmail.com> wrote in message
news:1181205063.304596.159350@.p47g2000hsd.googlegroups.com...
> Thanks for your help. I found the trigger I was looking for!!! It's
> possible to know the code of the trigger?
> On Jun 7, 10:04 am, "vt" <vinu.t.1...@.gmail.com> wrote:
>> Hi
>> Hope you using sql 2000
>> SELECT
>> name,
>> status = CASE WHEN OBJECTPROPERTY (id, 'ExecIsTriggerDisabled') = 0
>> THEN 'Enabled' ELSE 'Disabled' END,
>> Table_name = OBJECT_NAME (parent_obj)
>> FROM
>> sysobjects
>> WHERE
>> type = 'TR'
>> the above select returns all the triggers in the database.
>> then use the ALTER TABLE to disable the trigger
>> --
>> VT
>> Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic"
>> <jaume...@.gmail.com> wrote in message
>> news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
>>
>> > Hi,
>> > I've a DB not designed by me. I found that there is a trigger updating
>> > table B when I update table A. I want to disable this trigger but I
>> > don't know the name. Can someone help me? Thanks.- Hide quoted text -
>> - Show quoted text -
>|||On Jun 7, 1:47 pm, "vt" <vinu.t.1...@.gmail.com> wrote:
> Hi
> sp_helptext triggername
> See bol for more info
> regards
> VT
> Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic" <jaume...@.gmail.com> wrote in message
> news:1181205063.304596.159350@.p47g2000hsd.googlegroups.com...
>
> > Thanks for your help. I found the trigger I was looking for!!! It's
> > possible to know the code of the trigger?
> > On Jun 7, 10:04 am, "vt" <vinu.t.1...@.gmail.com> wrote:
> >> Hi
> >> Hope you using sql 2000
> >> SELECT
> >> name,
> >> status = CASE WHEN OBJECTPROPERTY (id, 'ExecIsTriggerDisabled') = 0
> >> THEN 'Enabled' ELSE 'Disabled' END,
> >> Table_name = OBJECT_NAME (parent_obj)
> >> FROM
> >> sysobjects
> >> WHERE
> >> type = 'TR'
> >> the above select returns all the triggers in the database.
> >> then use the ALTER TABLE to disable the trigger
> >> --
> >> VT
> >> Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic"
> >> <jaume...@.gmail.com> wrote in message
> >>news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
> >> > Hi,
> >> > I've a DB not designed by me. I found that there is a trigger updating
> >> > table B when I update table A. I want to disable this trigger but I
> >> > don't know the name. Can someone help me? Thanks.- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
> - Show quoted text -
select object_definition(object_id(<trigger name>))
sp_helptext <table name>
select definition from sys.sql_modules where object_id =object_id(<trigger name>)|||Thanks to everybody for your help! With your posts and some
imagination i solved out the problem!
C U!
On Jun 7, 4:52 pm, amish <shahami...@.gmail.com> wrote:
> On Jun 7, 1:47 pm, "vt" <vinu.t.1...@.gmail.com> wrote:
>
>
> > Hi
> > sp_helptext triggername
> > See bol for more info
> > regards
> > VT
> > Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic" <jaume...@.gmail.com> wrote in message
> >news:1181205063.304596.159350@.p47g2000hsd.googlegroups.com...
> > > Thanks for your help. I found the trigger I was looking for!!! It's
> > > possible to know the code of the trigger?
> > > On Jun 7, 10:04 am, "vt" <vinu.t.1...@.gmail.com> wrote:
> > >> Hi
> > >> Hope you using sql 2000
> > >> SELECT
> > >> name,
> > >> status = CASE WHEN OBJECTPROPERTY (id, 'ExecIsTriggerDisabled') = 0
> > >> THEN 'Enabled' ELSE 'Disabled' END,
> > >> Table_name = OBJECT_NAME (parent_obj)
> > >> FROM
> > >> sysobjects
> > >> WHERE
> > >> type = 'TR'
> > >> the above select returns all the triggers in the database.
> > >> then use the ALTER TABLE to disable the trigger
> > >> --
> > >> VT
> > >> Knowledge is power, share it...http://oneplace4sql.blogspot.com/"klonic"
> > >> <jaume...@.gmail.com> wrote in message
> > >>news:1181202534.816813.51310@.m36g2000hse.googlegroups.com...
> > >> > Hi,
> > >> > I've a DB not designed by me. I found that there is a trigger updating
> > >> > table B when I update table A. I want to disable this trigger but I
> > >> > don't know the name. Can someone help me? Thanks.- Hide quoted text -
> > >> - Show quoted text -- Hide quoted text -
> > - Show quoted text -
> select object_definition(object_id(<trigger name>))
> sp_helptext <table name>
> select definition from sys.sql_modules where object_id => object_id(<trigger name>)- Hide quoted text -
> - Show quoted text -

Friday, March 9, 2012

Find out how much data was replicated

Hi
I use SQL Servers 2000 SP3 on Windows 2000 Advanced Server
SP4. I've set up a transactional replication w/o updating
between two servers, one of which is a publisher and the
other is a distributor/pull-subscriber. I wonder if SQL
Server has means of finding out how much data was
replicated (i.e. sent to the subscriber), say, during the
day. If it hasn't, are there any third-party tools, which
would allow me to do this?
--
Many thanks,
Oskcheck the replication monitor in EM it will display a "gross" level of
information processed by article published.
"Osk" wrote:
> Hi
> I use SQL Servers 2000 SP3 on Windows 2000 Advanced Server
> SP4. I've set up a transactional replication w/o updating
> between two servers, one of which is a publisher and the
> other is a distributor/pull-subscriber. I wonder if SQL
> Server has means of finding out how much data was
> replicated (i.e. sent to the subscriber), say, during the
> day. If it hasn't, are there any third-party tools, which
> would allow me to do this?
> --
> Many thanks,
> Osk
>|||Hi
What do you mean by "gross" level? I need to know how much
bytes were delivered to the subscriber during a time interval.
--
Thanks,
Osk
>--Original Message--
>check the replication monitor in EM it will display a
"gross" level of
>information processed by article published.
>"Osk" wrote:
>> Hi
>> I use SQL Servers 2000 SP3 on Windows 2000 Advanced Server
>> SP4. I've set up a transactional replication w/o updating
>> between two servers, one of which is a publisher and the
>> other is a distributor/pull-subscriber. I wonder if SQL
>> Server has means of finding out how much data was
>> replicated (i.e. sent to the subscriber), say, during the
>> day. If it hasn't, are there any third-party tools, which
>> would allow me to do this?
>> --
>> Many thanks,
>> Osk
>>
>.
>