<%@ Register Src="~/controls/textLinkAds.ascx" TagName="textLinkAds" TagPrefix="tla"%> SuperWasp - Productivity tips, reviews, tools, software and gadgets.
SuperWasp

SuperWasp

Productivity tips, reviews, tools, software and gadgets.

 
How-To: Copy SQL table with identity to other database
If you ever wanted to copy a database table with contents to a different database, including the identity columns used for primary and foreign key relations, you might encounter an error message similar to this:
Msg 8101, Level 16, State 1, Line 2
An explicit value for the identity column in table 'D:\Db\Target.MDF.dbo.Languages' can only be specified when a column list is used and IDENTITY_INSERT is ON.

Here is the working SQL Query code to solve this problem:

SET IDENTITY_INSERT [D:\Db\Target.MDF].dbo.Languages ON
GO

INSERT INTO [D:\Db\Target.MDF].dbo.Languages (LanguageID, LanguageCodeID, CountryID, NameType, Name)
SELECT LanguageID, LanguageCodeID, CountryID, NameType, [Name]
FROM [D:\Db\Source.MDF].dbo.Languages AS SourceTable
GO

SET IDENTITY_INSERT [D:\Db\Target.MDF].dbo.Languages OFF
GO

Note the use of IDENTITY_INSERT and the list of columns before the SELECT statement.

Labels: , ,

» Full Article

  Posted by oVan on Wednesday, May 28, 2008 | PermaLink | 0 comments
Download SQL Server Compact 3.5 and Sync for ADO.NET 1.0

Microsoft made available the Microsoft SQL Server Compact 3.5 and Microsoft Synchronization Services for ADO.Net v1.0 for Windows Desktop package on their download site.

SQL Server Compact 3.5 includes a host of new features including the following:

  • LINQ to SQL enabling developers to integrate data access directly into their code
  • Side-by-side installation together with SQL Server 2005 Compact Edition (version 3.1)
  • Support for newer and more secure encryption algorithms
  • Additional timestamp (rowversion) data type
  • Enhanced support for Transact-SQL statements including:
    • Nested query in FROM clause
    • CROSS APPLY and OUTER APPLY
    • CAST and DECIMAL
    • SET IDENTITY INSERT
    • TOP
  • Synchronization Services for ADO.NET providing the ability to synchronize data from disparate sources over two-tier, N-tier, and service-based architectures
  • Support for System.Transactions

More information:

» Download Microsoft SQL Server Compact 3.5 & Microsoft Synchronization Services for ADO.Net v1.0 for Windows Desktop

Labels: , , , ,

» Full Article

  Posted by oVan on Tuesday, November 27, 2007 | PermaLink | 0 comments
Older articles are stored in the archives (see sidebar).