Showing posts with label stupid. Show all posts
Showing posts with label stupid. Show all posts

Wednesday, March 28, 2012

relationship question

Hi It may be a stupid question but I can not see why I define a relationship
and disable the option "Disabling a Foreign Key Constraint with INSERT and
UPDATE Statements"
in this case I just dont define the relationship.
Somebody can say a comment.
You can define FK on tables on simply disable them for loading
maintainance or other purposes, and then enable them again. Otherwise
you would have to drop them and recreate them.
CREATE TABLE SomeParentTable
(
ParentPKCol INT
CONSTRAINT PK_SomeParentTable PRIMARY KEY (ParentPKCol)
)
Create table SomeChildTable
(
PKChildCol INT,
ParentPKCol INT NOT NULL
CONSTRAINT fk1_SomeParentTable
FOREIGN KEY
REFERENCES SomeParentTable (ParentPKCol)
)
--Doesn=B4t work, CHECK is enabled
insert into SomeChildTable Values (1,1)
--Disabling the CHECK
ALTER TABLE SomeChildTable NOCHECK CONSTRAINT fk1_SomeParentTable
--This works now
insert into SomeChildTable Values (1,1)
--Delete it once again
DELETE FROM SomeChildTable
--THis is the normal behaviour
ALTER TABLE SomeChildTable NOCHECK CONSTRAINT fk1_SomeParentTable
--Inserting first the parent then the child records
insert into SomeParentTable Values (1)
insert into SomeChildTable Values (1,1)
Drop table SomeChildTable
Drop table SomeParentTable
HTH, Jens Suessmeyer.
|||Ohh absolutly, now I see the reason
Kenny M.
"Jens" wrote:

> You can define FK on tables on simply disable them for loading
> maintainance or other purposes, and then enable them again. Otherwise
> you would have to drop them and recreate them.
>
> CREATE TABLE SomeParentTable
> (
> ParentPKCol INT
> CONSTRAINT PK_SomeParentTable PRIMARY KEY (ParentPKCol)
> )
> Create table SomeChildTable
> (
> PKChildCol INT,
> ParentPKCol INT NOT NULL
> CONSTRAINT fk1_SomeParentTable
> FOREIGN KEY
> REFERENCES SomeParentTable (ParentPKCol)
> )
>
> --Doesn′t work, CHECK is enabled
> insert into SomeChildTable Values (1,1)
> --Disabling the CHECK
> ALTER TABLE SomeChildTable NOCHECK CONSTRAINT fk1_SomeParentTable
> --This works now
> insert into SomeChildTable Values (1,1)
> --Delete it once again
> DELETE FROM SomeChildTable
> --THis is the normal behaviour
> ALTER TABLE SomeChildTable NOCHECK CONSTRAINT fk1_SomeParentTable
> --Inserting first the parent then the child records
> insert into SomeParentTable Values (1)
> insert into SomeChildTable Values (1,1)
>
> Drop table SomeChildTable
> Drop table SomeParentTable
>
> HTH, Jens Suessmeyer.
>
sql

Monday, March 26, 2012

Relations

Maybe a stupid question but...

is it posible to add relations in sql compact databases (.sdf) ?

I tried in server explorer (in orcas) and there is no option for relations. Also .sdf file cannot be opened in SQL Server Express Management Studio SP2 because is version 3.5.

This SQL code will do the trick:

Code Snippet

ALTERTABLE EQMetaData ADDCONSTRAINT FK_Reference FOREIGNKEY([EQID])REFERENCES Equipments ([ID])

In version 3.5 there will be a GUI for modifying relations, but for now you must use SQL code.

sql

Wednesday, March 21, 2012

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,
Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default...b;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>
sql

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,
If you remove and then re-install MSDTC, you may need to restart SQL Server
for it to be able to use it. MSDTC has to be running when SQL Server starts
or it cannot use it. I am not sure this will resolve the problem, but I
would stop MSDTC and SQL Server. Then start MSDTC and verify that it is
running. Then start SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.
|||Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default...b;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default.aspx?scid=kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,If you remove and then re-install MSDTC, you may need to restart SQL Server
for it to be able to use it. MSDTC has to be running when SQL Server starts
or it cannot use it. I am not sure this will resolve the problem, but I
would stop MSDTC and SQL Server. Then start MSDTC and verify that it is
running. Then start SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/defaul...kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/defaul...kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Monday, February 20, 2012

Registering by massive way sql servers

hi everyone,
Imagine you have 20 workstations and for each of them you've got to register
by MMC around 30 sql servers. It's stupid to imagine do a registered one by
one if you know that all of them have the same password and overall, you hav
e
a list containing the IP's
file:
10.0.12.1 user tr1
10.0.12.2 user tr1
...
Sql25k is coming but not yet...
Thanks in advance,
--
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''''s hard to provide information
without seeing the code. location: Alicante (ES)why do you need to register all the workstations on all the servers? if
you're doing things on all workstations from all servers I would have
thought you'd be scripting out changes anyway.|||Found this on the web; use VBScript and SQLDMO:
http://www.wardyit.com/blog/blog/ar...6/02/18/85.aspx
HTH,
Stu|||thanks to both
--
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''''s hard to provide information
without seeing the code. location: Alicante (ES)
"Stu" wrote:

> Found this on the web; use VBScript and SQLDMO:
> http://www.wardyit.com/blog/blog/ar...6/02/18/85.aspx
> HTH,
> Stu
>