Bug: ALTER TABLE *** WITH NOCHECK Does Not Work For SQL Server 2005

May 11, 2006

I wanted to turn off 'Enforce Foreign Key Constrain' using SQL. However, it did not work on the SQL Server 2005 database.

For example, running following SQL in Management Studio, and the result showed that 'Enforce Foreign Key Constrain' property for the newly created constraint was still enabled.

ALTER TABLE [dbo].[Tags] WITH NOCHECK ADD CONSTRAINT [FK_Tags_ChannelID] FOREIGN KEY([ChannelID]) REFERENCES [dbo].[Channels] ([ID])

Does anybody know any way to get around with this problem. It is quite important for my software.

Ps. with the SP1, problem remains the same.

View 3 Replies


ADVERTISEMENT

Alter Table Nocheck Constraint Still Some Dependencies

May 17, 2006

Hi.I'm getting errors like this when I try to run an upgrade script I'm trying towrite/test:altering labels to length 60Server: Msg 5074, Level 16, State 4, Line 5The object 'ALTPART_ANNOT_ANNOTID_FK' is dependent on column 'label'.I used this to bracket my script:sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"gosp_msforeachtable "ALTER TABLE ? DISABLE TRIGGER all"go/* updates here */sp_msforeachtable @command1="print '?'",@command2="ALTER TABLE ? CHECK CONSTRAINT all"gosp_msforeachtable @command1="print '?'",@command2="ALTER TABLE ? ENABLE TRIGGER all"goI guess the alter table nocheck constraint isn't disabling the fk'scompletely?Is there a way around this, or do I manually have to do the constraintdropping/recreating?ThanksJeff Kish

View 3 Replies View Related

Alter Table Does Work?!?

Feb 28, 2000

alter table amy_table add(Category varchar(64));

says that my syntax is wrong ... can anyone help?

View 3 Replies View Related

Alter Table Sql 2005

Jun 13, 2008

I have imported products table from ms-access to sql server 2005.
So I have already 88 products.
I need to change the Primary key, to auto increment by 1.
I tried this statement,
ALTER TABLE Products ALTER COLUMN ProductsRecordID IDENTITY (89, 1)

But why I got an error
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IDENTITY'.
Much appreciate your help

View 4 Replies View Related

2005 Replication Alter Table ?

Oct 3, 2006

Hi There

I am using transactional replication in 2005.

I am used to 2000 where if a column was added or changed to had to use sp's to do this and for altering a column you had to drop the subscription change and add back etc.

With 2005 is this fully handled by ALTER TABLE, can i safely make any meta data changes to an article with ALTER TABLE and the changes will progate to subscribers no problem.

Or are there limitations are there certain changes to articles that must still be done through sp's?

Thanx

View 1 Replies View Related

Alter Table Alter Column In MSACCESS. How Can I Do It For A Decimal Field?

Jul 23, 2005

Hi people,I?m trying to alter a integer field to a decimal(12,4) field in MSACCESS 2K.Example:table : item_nota_fiscal_forn_setor_publicofield : qtd_mercadoria integer NOT NULLALTER TABLE item_nota_fiscal_forn_setor_publicoALTER COLUMN qtd_mercadoria decimal(12,4) NOT NULLBut, It doesn't work. A sintax error rises.I need to change that field in a Visual Basic aplication, dinamically.How can I do it? How can I create a decimal(12,4) field via script in MSACCESS?Thanks,Euler Almeida--Message posted via http://www.sqlmonster.com

View 1 Replies View Related

Why Variables In A Alter Or Drop Does Not Work.

Oct 26, 1999

I am writing a procedure to drop a specific user's schema only. I select all his/her table name and foreign key in a temp table first and then use a cursor to get the table name and foreign key, and begin drop foreign keys and drop table. However, sql think it is wrong with the syntax like "alter @table_name". Does anyone have a clue, what is wrong with my syntax. Or someone know how to drop one specific user's schema only (Other user may have same table in the database, and you don't want to drop that.

Attached is my scripts: please correct it. Thanks.

CREATE procedure sp_drop_schema @user sysname
as

select o.name table_names, o.id table_id, s.parent_obj Key_id, s.name key_name, u.name users_name
into #temp1
from sysobjects o inner
join sysobjects s on o.id=s.parent_obj
join sysusers u on o.uid=u.uid
where s.type='f' and u.name=@user

declare cur_f cursor
for select table_names, key_name

declare @table_name varchar (80), @key_name varchar (80)

open cur_f

fetch next from cur_f into @table_name, @key_name
while @@fetch_status=0 begin
alter table @table_name
drop constraint @key_name
fetch next from cur_f into @table_name, @key_name
end
close cur_f
deallocate cur_f
drop table #temp1

select o.name table_name, o.id table_id, o.uid users_id, u.name users_name
into #temp2
from sysobjects o
inner join sysusers u on o.uid=u.uid
where type='u' and u.name=@user

declare cur_temp cursor
for
select table_name
from #temp2

declare @tab_name varchar (80)
open cur_temp
fetch next from cur_temp into @tab_name
while @@fetch_status=0 begin
drop table @tab_name
fetch next from cur_temp into @tab_name
end
close cur_temp
deallocate cur_temp
drop table #temp2

View 1 Replies View Related

SQL Server 2008 :: Alter Table Triggers Recreate Table?

May 26, 2015

which ALTER TABLE/ALTER COLUMN- Statement has a Recreate Table as result ?

View 2 Replies View Related

DB Engine :: Alter Database With Rollback Immediate Statement Doesn't Work

Nov 9, 2015

Primary platofrm: Sql12k, 7.0 Ultimate Pro OS

I'm launching the aforementioned statement from one MASTER session windows and I get this message, I am stuck, I though ROLLBACK INMEDIATE go throught any already session open.

Msg 5064, Level 16, State 1, Line 1
Changes to the state or options of database 'GFSYSTEM' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.

View 4 Replies View Related

Alter Table Alter Column

Jul 20, 2005

I would like to add an Identity to an existing column in a table using astored procedure then add records to the table and then remove the identityafter the records have been added or something similar.here is a rough idea of what the stored procedure should do. (I do not knowthe syntax to accomplish this can anyone help or explain this?Thanks much,CBLCREATE proc dbo.pts_ImportJobsas/* add identity to [BarCode Part#] */alter table dbo.ItemTestalter column [BarCode Part#] [int] IDENTITY(1, 1) NOT NULL/* add records from text file here *//* remove identity from BarCode Part#] */alter table dbo.ItemTestalter column [BarCode Part#] [int] NOT NULLreturnGOSET QUOTED_IDENTIFIER OFFGOSET ANSI_NULLS ONGOhere is the original tableCREATE TABLE [ItemTest] ([BarCode Part#] [int] NOT NULL ,[File Number] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_File Number] DEFAULT (''),[Item Number] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Item Number] DEFAULT (''),[Description] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Description] DEFAULT (''),[Room Number] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Room Number] DEFAULT (''),[Quantity] [int] NULL CONSTRAINT [DF_ItemTest_Quantity] DEFAULT (0),[Label Printed Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Label Printed Cnt]DEFAULT (0),[Rework] [bit] NULL CONSTRAINT [DF_ItemTest_Rework] DEFAULT (0),[Rework Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Rework Cnt] DEFAULT (0),[Assembly Scan Cnt] [int] NULL CONSTRAINT [DF_ItemTest_Assembly Scan Cnt]DEFAULT (0),[BarCode Crate#] [int] NULL CONSTRAINT [DF_ItemTest_BarCode Crate#] DEFAULT(0),[Assembly Group#] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Assembly Group#] DEFAULT (''),[Assembly Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULLCONSTRAINT [DF_ItemTest_Assembly Name] DEFAULT (''),[Import Date] [datetime] NULL CONSTRAINT [DF_ItemTest_Import Date] DEFAULT(getdate()),CONSTRAINT [IX_ItemTest] UNIQUE NONCLUSTERED([BarCode Part#]) ON [PRIMARY]) ON [PRIMARY]GO

View 2 Replies View Related

Alter Table Alter Column...

Oct 8, 2007

I am using sql server ce.I am changing my tables sometimes.how to use 'alter table alter column...'.for example:I have table 'customers', I delete column 'name' and add column 'age'.Now I drop Table 'customers' and create again.but I read something about 'alter table alter column...'.I use thi command but not work.I thing syntax not true,that I use..plaese help me?



my code:
Alter table customers alter column age

View 7 Replies View Related

Using 'Alter Login' To Change Password In SQL Server 2005

Sep 26, 2006

Please Help!!

We have an application using SQLOLEDB connection to a SQL Server 2005 database. Per domain policy, the users are required to change their password every 60 days.

The accounts are established to 'Enforce password policy'.

When we try to execute the 'ALTER LOGIN' command to change the password, locks are being established and will not free the account without bouncing the instance.

After issuing the command, any interaction with the server using this UserID results in a "lock request time out" error 1222.

I have tried issuing this command using both the application and through SQLServer Mgmt Studio Express and the results are the same.

Any idea would be greatly appreciated.



Rusty Rickmon

View 5 Replies View Related

Nocheck

Apr 9, 2004

I need to insert data into a table..please advise SQL Syntax on how to disable and enable constraints and triggers on the table before and after the inserts!

Thanks..

View 2 Replies View Related

SQL Server 2008 :: Need To Recompile Stored Procedure After A Table Alter?

Feb 5, 2015

Version 2008 R2

The stored procedure has the dependency on the table that was altered.

View 4 Replies View Related

SQL Server 2008 :: Alter Column And Reindex 100M Row Table?

Jun 3, 2015

I inherited a system which has an index on a set of columns which allow more than 900 bytes of data in it. We know one of the fields can be shortened to shrink the potential key size below 900 bytes.

The problem is the table is about 120m rows, and the index currently on that column is seeked (sought?) on about 2.5m times a day.

At its simplest, I want to drop the existing index, alter the column to shrink the varchar size, and then rebuild the index on the newly shortened column.

On a smaller, less used table, I might just do this in outside of business hours and call it a day, but I'm concerned that this will take a long time and block a lot of operations.

1) IIRC, shrinking a column, unlike widening it, is much more expensive, even if there are no values which would actually end up trunacted. Is this right?

2) I did a few tests on some other smaller (2+ m) row tables and was still able to select data out of the table. I don't think this covered all the read scenarios, but are there known scenarios which would simply not work during an index build?

3) I haven't yet tried DML operations to the table while it's doing either the column update or an index build. what scenarios would or would not be blocked?

View 0 Replies View Related

SQL Server 2014 :: Alter Table Add 2 Fields Takes Too Long

Sep 25, 2015

We have a proc that adds some fields to a few tables of ours and normally there are no issues. For one of our client databases this process is taking anywhere from 5-10 minutes to add the fields. This causes an issue where the app will timeout waiting. After plugging around and looking at the proc and trying different items i found it to only be for this one database and ONLY when there is data in the table. If i truncate the table and run the same procedure everything is fine. Tables all have same index on 4 columns and the columns being added are not indexed because of the stupid hoops we have to jump thru to pre-pivot data for our reporting package.

View 4 Replies View Related

No Support For WITH NOCHECK?

Apr 11, 2008

SQL CE does not seem to support WITH NOCHECK constraint when altering the table to add a foreign key. How can I work around this?

View 3 Replies View Related

VS 2005 Doesn't Work With SQL Server 2005.

Jul 23, 2007

When I try to add a SQL Server Database as a new item into the App_Data folder of my Web Project, I get this error demanding that SQL Server Express has to be installed. That is the stupidest thing I have ever heard of. Is there some setting or something to make VS 2005 Pro work with a standard SS database? I don't want to use the express edition. I can't use SS's management studio with that.



Does Microsoft monitor this forum? I thought they were going to be taking technology forward; not backwards. I'm losing a lot of time having to install and uninstall and reinstall to get the environment into a mode that works lke I want it to work. If they didn't intend for SS standard edition to be used with VS 2005 Pro, then why did they include SS developers edition in the Pro package?

View 2 Replies View Related

SQL 2012 :: Creating FK With NoCheck

Aug 11, 2014

Is there away to get the SQL FK constrain to trust old data when the FK is created with NoCheck.?

Some things to ponder

- Assume the table where the FK is created is too large and cant afford a significant down time, but still need the query optimizer to trust the data in the FK for optimal query plans.

- As pre-deploy script will validate the older data in the FK columns for consistency

View 2 Replies View Related

NOCHECK Constraint Supported?

Sep 28, 2007

Is a NOCHECK constraint supported in CE 3.5? The keyword is listed in the 3.5 BOL but when attempting to ALTER TABLE using WITH NOCHECK the statement fails.

If it is not supported then is there a work around for it?

TIA

View 1 Replies View Related

Can .net 1.1 Work With SQL SERVER 2005 ?

Jul 13, 2007

 What should I do if I want my asp.net 1.1 work with sql server 2005I get wrong message : SQL Server does not exist or access denied

View 5 Replies View Related

How To Work In SLQ Server 2005

Nov 26, 2007

I am moving my site to a host that has SQL Server 2005. I am pretty goodwith Access, but I don't know much about SQL Server.I'm currently using SQL Server 2000, and I access it with Access 2000, whichmeans I can't do a lot.Would I be able to work in it using SAL Server Express? What I amparticularly interested in, is being able to run queries (views).I need to update stock every day. If I was using Access I would import orlink the new stock table, and then join the 2 tables by the product number -(the product table and the new stock table), and pull the records where thestock amounts were different, then copy the column from the stock table tothe product table (or do an update query, although copying is usuallyquicker and easier).I would do that, not just for stock amounts, but for price changes, to adddescriptions, and a few other things.How can I do that in SQL Server 2005? What program do I need to have on mydesktop to do that?Please explain in baby terms, if possible!Thanks!

View 1 Replies View Related

Cant Get SQL Server 2005 To Work

Feb 8, 2007

Hello ia m trying to install SQL Server 2005 but i am unable to run it. I installed Net Framework 2.0
Then i have tried the following files:
SQLEXPR.EXE
SQLEXPR_ADV.EXE
Then i installed Service PAck 1 for that but an error occoured during the install.

Basiclly i have no idea what i am doing here. It creates a configuration tools start menu item but it seems just like configuration. In C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLBinn there is a file called sqlservr.exe but all it does is create a black console window and does nothing.

OS: XP Pro + SP2

How to get it to work?

Thank You

View 4 Replies View Related

TSQL - Using ALTER TABLE - ALTER COLUMN To Modify Column Type / Set Identity Column

Sep 7, 2007

Hi guys,
If I have a temporary table called #CTE
With the columns
[Account]
[Name]
[RowID Table Level]
[RowID Data Level]
and I need to change the column type for the columns:
[RowID Table Level]
[RowID Data Level]
to integer, and set the column [RowID Table Level] as Identity (index) starting from 1, incrementing 1 each time.
What will be the right syntax using SQL SERVER 2000?

I am trying to solve the question in the link below:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2093921&SiteID=1

Thanks in advance,
Aldo.

I have tried the code below, but getting syntax error...



ALTER TABLE #CTE
ALTER COLUMN
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;


I have also tried:

ALTER TABLE #CTE
MODIFY
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;







View 18 Replies View Related

Help, Did SP1 Install Work?? SQL Server 2005

Feb 24, 2007

Hi,This is the log file for my SP1 on 2005 install. Can anyone pleaselook at this and tell me if this looks normal?I'm concerned about the following in the log:"Failed to read registry key: Debug"ANDall the entries that show "- Not Applied"What does this mean?According to SELECT SERVERPROPERTY('ProductLevel') my service pack is"SP1", so everything appears "normal".However, I had to apply the service pack a couple times because thefirst try gave "locked files" error. I did not reboot after theinitial SQL Server 2005 installation, which I think may have caused aproblem, but I don't know. I reapplied the SP1 two more times afterthe reboot. This is the log file from the third try (the second logfile looked identical).THANKS02/23/2007 14:51:31.778================================================== ==============================02/23/2007 14:51:31.778 Hotfix package launched02/23/2007 14:51:56.077 Attempting to install instance: SQL ServerNative Client02/23/2007 14:51:56.077 Attempting to install target: SQL102/23/2007 14:51:56.109 Attempting to install file: sqlncli.msi02/23/2007 14:51:56.140 Attempting to install file: \SQL1l$a08e113ab889fa7a0bHotFixSqlncliFilessqlncli.ms i02/23/2007 14:51:56.156 Creating MSI install log file at: C:WINDOWSHotfixRedist9LogsRedist9_Hotfix_KB913090_sqlnc li.msi.log02/23/2007 14:51:56.172 Successfully opened registry key: SoftwarePoliciesMicrosoftWindowsInstaller02/23/2007 14:51:56.188 Failed to read registry key: Debug02/23/2007 14:51:57.228 MSP returned 0: The action completedsuccessfully.02/23/2007 14:51:57.322 Successfully opened registry key: SoftwarePoliciesMicrosoftWindowsInstaller02/23/2007 14:51:57.338 Failed to read registry key: Debug02/23/2007 14:51:57.354 Successfully installed file: \SQL1l$a08e113ab889fa7a0bHotFixSqlncliFilessqlncli.ms i02/23/2007 14:51:57.369 Successfully installed target: SQL102/23/2007 14:51:57.401 Successfully installed instance: SQL ServerNative Client02/23/2007 14:51:57.41702/23/2007 14:51:57.432 Product Status Summary:02/23/2007 14:51:57.448 Product: SQL Server Native Client02/23/2007 14:51:57.480 SQL Server Native Client (RTM ) -Success02/23/2007 14:51:57.49502/23/2007 14:51:57.511 Product: Setup Support Files02/23/2007 14:51:57.527 Setup Support Files (RTM ) - NotApplied02/23/2007 14:51:57.54302/23/2007 14:51:57.574 Product: Database Services02/23/2007 14:51:57.590 Database Services (RTM 1399 ENU) -Not Applied02/23/2007 14:51:57.60602/23/2007 14:51:57.622 Product: Notification Services02/23/2007 14:51:57.637 Notification Services (RTM 1399ENU) - Not Applied02/23/2007 14:51:57.66902/23/2007 14:51:57.685 Product: Integration Services02/23/2007 14:51:57.700 Integration Services (RTM 1399 ENU)- Not Applied02/23/2007 14:51:57.71602/23/2007 14:51:57.732 Product: Client Components02/23/2007 14:51:57.748 Client Components (RTM 1399 ENU) -Not Applied02/23/2007 14:51:57.74802/23/2007 14:51:57.763 Product: MSXML 6.0 Parser02/23/2007 14:51:57.779 MSXML 6.0 Parser (RTM ) - NotApplied02/23/2007 14:51:57.79502/23/2007 14:51:57.811 Product: SQLXML402/23/2007 14:51:57.826 SQLXML4 (RTM ) - Not Applied02/23/2007 14:51:57.84202/23/2007 14:51:57.842 Product: Backward Compatibility02/23/2007 14:51:57.858 Backward Compatibility (RTM ) - NotApplied02/23/2007 14:51:57.87402/23/2007 14:51:57.889 Product: Microsoft SQL Server VSS Writer02/23/2007 14:51:57.905 Microsoft SQL Server VSS Writer(RTM ) - Not Applied02/23/2007 14:51:57.905

View 1 Replies View Related

Can SSIS Work Without SQL SERVER 2005

Feb 20, 2006

Can I install only [Bus....integ.. dev.... st..]. on my machine without SQL 2005? I have a sybase database management system.. can I work with SSIS?

Can it extract something from IBM DB2/DATACOM/LOTUS NOTES/VSAM/???

 

pl give me answers with justifications!!!!

View 8 Replies View Related

Can SQL Server Work With A Paradox Table?

Feb 18, 2006

I've never really setup or used MS SQL Server (just a couple hours, oneday, several months ago). I think MS SQL Server has the ability to use"linked tables", like MS Access does. Is this correct? What I want todo is have an MS SQL Server setup, which compatible applications cantalk with, but I want the data to come from a Paradox database. I canuse any MS SQL version, whatever would work best. I'm not sure aboutthe Paradox version, I know it is an old DOS version. I can't justconvert the data to another format, because Paradox still needs to useit.I tried using MS Access before, with ODBC drivers it *should* be ableto work with the Paradox data. However, I ended up with lots of datacorruption. I'm hoping MS SQL Server may work better, and not corruptthe Paradox data everytime it is updated.

View 4 Replies View Related

Order By Colums Asc Does Not Work In SQL SERVER 2005

Feb 12, 2008

Hello
 
Iam usng sql server 2005 database
 
I had this table
 
CREATE TABLE [dbo].[Companies](
[CompanyID] [smallint] IDENTITY(1,1) NOT NULL,
[Company] [nvarchar](40) NOT NULL,
 
I entered Arabic Names
 
so I write this query
select * from companies order by company asc
--and this one
select * from companies order by company
 
and I try to order desc
 
but the row didnt appear out ordered
 
and the big prtoblem happened when I try to update a company Its go to the last row when it appears
 
please help me
 
thanks

View 9 Replies View Related

Import TXT File Cannot Work On SQL Server 2005

Jan 11, 2008

I have imported a TXT file every week on SQL 2000. Options,
Fixed field
File Type: ANSI
Skip rows: 0
Row delimited: {CR}{LF}
Text qualifier: DoubleQuote{"} (default grayed out).

It works fine. On SQL 2005, I cannot.

If I keep same settings as SQL 2000, I cannot see file from Preview. If I change to Delimited, I can see file but there is only one column.

Any suggestion?

Thanks

ZYT

View 1 Replies View Related

SQL Server 2005 Does Not Work After OS Upgrade To Vista

Jun 27, 2007

My instance of SQL Server Developer stopped working after upgrade of OS from Vista to XP. I have also installed SP1 & SP2. Still it is not working. The message that I get when I start SQL Server Management Studio is "The application cannot start."

View 7 Replies View Related

Configuring A Domain && SQL SERVER 2005 To Work.

Dec 21, 2006

Attempting to link Access 2003 to SQL 2005, there is something keeping from doing so. 

1 I setup the instance as sqlexpress.

2 I have a database shell there also.

3 It connects when I start the instance service.

4 My remote connections are configured to handle TCP/IP & Named Pipes.

Not in this order, but you get the idea.  Now that I have these in place, I went first to the Access 2003 database to link the tables to this.  When I came accross trouble in the form of need for a DSN to the domain for the things I created above.

In attempting to create one that looked functional, I came back to the same step.  But, unsuccessful to link the tables again because browsing to that domain does not even show that particular file.  This is the problem.  

I do believe that once I am able to select a DSN, I will have a "healthy baby connection". I will then be the proud father of my first Server-side database setup!!!!  But I am trying to get over these labor pains. 

View 1 Replies View Related

SQL Server 2005 - Can't Get CASCADE DELETE To Work

Aug 13, 2007

I'm using SQL Server 2005 (product version = 9.00.1406.00, product level = RTM, and edition = Developer Edition). I have a db with a number of tables; I created a Foreign Key in one table and added a Foreign Key w/ ON DELETE CASCADE to it -- all using Microsoft SQL Server Management Studio. When I delete the record in the table with the foreign key, the record in the other table does not get deleted. I tried doing this with a simple SQL script in Microsoft SQL Server Management Studio and in a simple .Net / ADO (C#-based) program. Only the record in the table that I'm specifically deleting is deleted.


Here's the table that is referenced by the foreign key (I told Server Management Studio to write out the script):

USE [CHNOPSDb]
GO
/****** Object: Table [dbo].[tblDeviceContainer] Script Date: 08/13/2007 16:47:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblDeviceContainer](
[ID] [int] IDENTITY(1,1) NOT NULL,
[DeviceContainerTypeID] [int] NOT NULL,
CONSTRAINT [PK_tblDeviceContainer] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


Here's the table that has the foreign key to the above table (again, I told Management Studio to write out the script):

USE [CHNOPSDb]
GO
/****** Object: Table [dbo].[tblNode] Script Date: 08/13/2007 16:46:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblNode](
[ID] [int] IDENTITY(1,1) NOT NULL,
[NodeName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NodeTypeID] [int] NOT NULL,
[UnitID] [int] NOT NULL,
[pDeviceContainerID] [int] NOT NULL,
[NodeIndex] [int] NULL,
CONSTRAINT [PK_Node] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
USE [CHNOPSDb]
GO
ALTER TABLE [dbo].[tblNode] WITH CHECK ADD CONSTRAINT [FK_tblNode_tblDeviceContainer] FOREIGN KEY([pDeviceContainerID])
REFERENCES [dbo].[tblDeviceContainer] ([ID])
ON DELETE CASCADE


I then perform a delete using the following:


Use CHNOPSDb;

delete from tblNode where ID = 1;


It deletes the tblNode record but doesn't delete the tblDeviceContainer record that is referenced by tblNode.


Any help?

Thanks,
Bill

View 4 Replies View Related

SQL Server 2005 Setup Of 2 Vista Machines, Can't Get Individual Network Login Accounts To Work On Each Others SQL Server

Apr 16, 2008


Hello all,

I have 2 networked PC's both running vista ultimate

1st is Laptop and is running its own SQL Server at laptoplaptopSQL
2nd is Desktop and is running its own SQL Server at desktopdesktopSQL

Now both machines have seperate windows login accounts.

When I go SQL Server management studio I go to browse and each machine can see the other machines SQL Server, but when I go to login I get SQL Login falied for users" The user is not associaed with a trusted SQL server connection".

So I then go to logins new login and try to add my other pc's user account.
The problem I see is that when I go to search and then location it only shows its own PC's location and not the location of my other networked pc? So if I am on Desktop and in my theory want to add laptopuser to the desktop SQL Server logins I get:

"create failed for login laptopuser

An exception occurred while executing Transact SQL statement laptopuser is not a valid windows NT name. give the complete name


Not sure on where to go from here.

Any help would be great

View 10 Replies View Related







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