Showing posts with label quotcannot. Show all posts
Showing posts with label quotcannot. Show all posts

Saturday, February 25, 2012

"Cannot truncate table 'Database.dbo.Table' because it is being referenced by a FOREIGN K

Here is my issue I am new to 2005 sql server, and am trying to take my old data which is exported to a txt file and import it to tables in sql. The older database is non relational, and I had made several exports for the way I want to build my tables. I built my packages fine and everything is working until I start building relationships. I remove my foreign key and the table with the primary key will get updated for the package again. I need to update the data daily into sql, and once in it will only be update from the package until the database is moved over.

It will run and update with a primary key until I add a foreign key to another database.

Here is my error when running the package when table 2 has a foreign key.

[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE [consumer].[dbo].[Client] " failed with the following error: "Cannot truncate table 'consumer.dbo.Client' because it is being referenced by a FOREIGN KEY constraint.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

You are trying to delete all data out of Client, but are prevent when there is FK. Find out table is related to Client by the FK, perhaps something relate dto teh client like the client's orders? You will need to delete that table first to keep with the current method.

If you do not want delete this other table, then you should not be deleting clients either. You cannot apply a relationship and then expect to be able to violate it during a load.

There are three methods youd could use to avoid this error -

Delete all tables, but in order.

Do not delete. When loading clients detect existing clients and update, versus inserting new clients.

Disable the constraint for the duration of the load, and then reenable afterwards. You can just write some simple T-SQL, ALTER TABLE... to do this, and run it at the start and end of your package so as to disable and enable the constriant(s) respectively. Use some Execute SQL Tasks to run the T-SQL.

|||

I totally understand what you are saying, and I can't delete the table while there is a relationship. I read this article http://blogs.conchango.com/jamiethomson/archive/2006/02/17/2877.aspx that was posted in the forum. I was unable to disable the constraint would I want to disable the PK or FK and from the table I am trying to update or the FK that has the issue.

In my job I have 4 seperate integration jobs that run should this be one large integration job?

"Cannot truncate table 'Database.dbo.Table' because it is being referenced by a FOREI

Here is my issue I am new to 2005 sql server, and am trying to take my old data which is exported to a txt file and import it to tables in sql. The older database is non relational, and I had made several exports for the way I want to build my tables. I built my packages fine and everything is working until I start building relationships. I remove my foreign key and the table with the primary key will get updated for the package again. I need to update the data daily into sql, and once in it will only be update from the package until the database is moved over.

It will run and update with a primary key until I add a foreign key to another database.

Here is my error when running the package when table 2 has a foreign key.

[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE [consumer].[dbo].[Client] " failed with the following error: "Cannot truncate table 'consumer.dbo.Client' because it is being referenced by a FOREIGN KEY constraint.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

You are trying to delete all data out of Client, but are prevent when there is FK. Find out table is related to Client by the FK, perhaps something relate dto teh client like the client's orders? You will need to delete that table first to keep with the current method.

If you do not want delete this other table, then you should not be deleting clients either. You cannot apply a relationship and then expect to be able to violate it during a load.

There are three methods youd could use to avoid this error -

Delete all tables, but in order.

Do not delete. When loading clients detect existing clients and update, versus inserting new clients.

Disable the constraint for the duration of the load, and then reenable afterwards. You can just write some simple T-SQL, ALTER TABLE... to do this, and run it at the start and end of your package so as to disable and enable the constriant(s) respectively. Use some Execute SQL Tasks to run the T-SQL.

|||

I totally understand what you are saying, and I can't delete the table while there is a relationship. I read this article http://blogs.conchango.com/jamiethomson/archive/2006/02/17/2877.aspx that was posted in the forum. I was unable to disable the constraint would I want to disable the PK or FK and from the table I am trying to update or the FK that has the issue.

In my job I have 4 seperate integration jobs that run should this be one large integration job?

"Cannot open user default database"

[2005 Developer Edition] In Management Studio I changed my default database to a user db. I subsequently unselected that db as the default leaving me with no default db (I think - it's been awhile and I may not have this exactly right). But regardless, I can no longer Connect to Server using Management Studio (Windows authentication) - I get

Cannot open user default database. Login failed.
Login failed for user 'DANA\Administrator'. (Microsoft SQL Server, Error: 4064)

The only thing suspicious in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG is

The SQL Network Interface library could not deregister the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b. Administrator should deregister this SPN manually to avoid client authentication errors.

From Configuration Manager > SQL Server > Properties > Advanced > Startup Parameters

-dC:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL\log\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL\data\mastlog.ldf

Any idea what's going on here?

Hi,

I guess these are two different errors. The one first mentioned can be changed by logging on with a sysadmin role account or securityadmin role account and using the statement sp_defaultdb 'DANA\Administrator','master'

HTH, jens Suessmeyer.


http://www.sqlserver2005.de

|||Management Studio cannot connect to the database engine, so what other tool or utility do I use to execute sp_defaultdb?|||

See if this thread helps you: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=388163&SiteID=1.

You should try specifying the database you want to use at connection time as shown in the above thread.

Thanks
Laurentiu

|||You can specify the database during the connection within Management Studio by clicking on the options button, remove the default value and select a valid database. Or use another tool like SQLCMD or OSQL to connect to the server with specifying a database.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

|||The thread reference did the trick - thanks a lot! BTW the original problem was caused by takinig the default (user) database offline, then exiting Management Studio.

"Cannot apply value null to property Login: Value cannot be null..".

I'm trying to use a transfer "SQL Server Objects Task" between a 2005 SQL Server Database and a 2000 SQL Sever Database. I have the login info specified in the connection I'm using.
According to the Debug Output the process truncates the destination tables but then stops with the: "Cannot apply value null to property Login: Value cannot be null..".
Any help anybody?
NFThis probably means that you need to specify a login to use in the transfer.

Could you repost this in the SSIS forum? (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1)|||

I had the same problem and I was specifying the sa login for my connection. When I tested the connection everything worked fine. But I received the same error message when I attempted to execute the package. I changed it to Windows Authentication and it worked fine. Unfortunately, I have to be able to specify a SQL login when I roll this into production.

I have tried all of the PackageProtectionLevels, but none seem to work. Any help would be greatly appreciated.

|||

I had the same problem. I installed SQL 2005 SP1 and it worked for me with SQL authentication.

|||

Unfortunately I’m using SSIS between a SQL 2000 (local) & SQL 2005 (remote). If I install SQL 2005 SP1 on my machine will that cure this problem – meaning, will the SSIS tools work properly?

-Cheers

|||Try changing your compatability level of the database to 2005

"Cannot apply value null to property Login: Value cannot be null..".

I'm trying to use a transfer "SQL Server Objects Task" between a 2005 SQL Server Database and a 2000 SQL Sever Database. I have the login info specified in the connection I'm using.
According to the Debug Output the process truncates the destination tables but then stops with the: "Cannot apply value null to property Login: Value cannot be null..".
Any help anybody?
NFThis probably means that you need to specify a login to use in the transfer.

Could you repost this in the SSIS forum? (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1)|||

I had the same problem and I was specifying the sa login for my connection. When I tested the connection everything worked fine. But I received the same error message when I attempted to execute the package. I changed it to Windows Authentication and it worked fine. Unfortunately, I have to be able to specify a SQL login when I roll this into production.

I have tried all of the PackageProtectionLevels, but none seem to work. Any help would be greatly appreciated.

|||

I had the same problem. I installed SQL 2005 SP1 and it worked for me with SQL authentication.

|||

Unfortunately I’m using SSIS between a SQL 2000 (local) & SQL 2005 (remote). If I install SQL 2005 SP1 on my machine will that cure this problem – meaning, will the SSIS tools work properly?

-Cheers

|||Try changing your compatability level of the database to 2005

Friday, February 24, 2012

"Cannot apply value null to property Login: Value cannot be null..".

I'm trying to use a transfer "SQL Server Objects Task" between a 2005 SQL Server Database and a 2000 SQL Sever Database. I have the login info specified in the connection I'm using.
According to the Debug Output the process truncates the destination tables but then stops with the: "Cannot apply value null to property Login: Value cannot be null..".
Any help anybody?
NFThis probably means that you need to specify a login to use in the transfer.

Could you repost this in the SSIS forum? (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1)|||

I had the same problem and I was specifying the sa login for my connection. When I tested the connection everything worked fine. But I received the same error message when I attempted to execute the package. I changed it to Windows Authentication and it worked fine. Unfortunately, I have to be able to specify a SQL login when I roll this into production.

I have tried all of the PackageProtectionLevels, but none seem to work. Any help would be greatly appreciated.

|||

I had the same problem. I installed SQL 2005 SP1 and it worked for me with SQL authentication.

|||

Unfortunately I’m using SSIS between a SQL 2000 (local) & SQL 2005 (remote). If I install SQL 2005 SP1 on my machine will that cure this problem – meaning, will the SSIS tools work properly?

-Cheers

|||Try changing your compatability level of the database to 2005

"Cannot apply value null to property Login: Value cannot be null..".

I'm trying to use a transfer "SQL Server Objects Task" between a 2005 SQL Server Database and a 2000 SQL Sever Database. I have the login info specified in the connection I'm using.
According to the Debug Output the process truncates the destination tables but then stops with the: "Cannot apply value null to property Login: Value cannot be null..".
Any help anybody?
NF
This probably means that you need to specify a login to use in the transfer.

Could you repost this in the SSIS forum? (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1)|||

I had the same problem and I was specifying the sa login for my connection. When I tested the connection everything worked fine. But I received the same error message when I attempted to execute the package. I changed it to Windows Authentication and it worked fine. Unfortunately, I have to be able to specify a SQL login when I roll this into production.

I have tried all of the PackageProtectionLevels, but none seem to work. Any help would be greatly appreciated.

|||

I had the same problem. I installed SQL 2005 SP1 and it worked for me with SQL authentication.

|||

Unfortunately I’m using SSIS between a SQL 2000 (local) & SQL 2005 (remote). If I install SQL 2005 SP1 on my machine will that cure this problem – meaning, will the SSIS tools work properly?

-Cheers

|||Try changing your compatability level of the database to 2005