rss search

next page next page close

Import and Export Wizard with Identity Column

I  want to move data from one DB to another, while keeping the identity column values in the old DB. When I run the wizard I get a validation error "Failure inserting into the read-only column "UID".

Where UID is an identity column on that table. How can I override the identity functionality in order to be able to import the data?
Answer  : By Enable identity insert. There's a check box when you click the Edit Mappings.
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

SQL Query – List Indexes

—- SQL Query – List Indexes

EXEC sp_helpindex 'tblgroups'

 

or

 

declare @tblName varchar(50);
set @tblName = 'tbltransaction';
SELECT     o.name as TableName, i.name AS IndexName
FROM         sysobjects o, sysindexes i
WHERE   (o.id = i.id and o.name = @tblName) AND (i.status = 18450 OR   i.status = 2097152)
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

SQL Query – List Columns of table MS Database

---- SQL Query - List Columns of table MS Database
exec sp_columns tblMobileNumbers
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

SQL Query – List the Fields in the Tables

---- SQL Query - List the Fields in the Tables
SELECT [name] AS [Column name] FROM syscolumns
WHERE id = (SELECT id FROM sysobjects WHERE type = 'U' AND [NAME] = 'tblAdmin')
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

SQL Query – List the Tables in the Database

---- List the Tables in the Database
Select * from sysobjects where xtype in ('u', 's') order by name
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

SQL Script-COUNT from multiple tables

There are many ways to aproach this (if the tables are not related):

SELECT
(SELECT COUNT(DISTINCT id) FROM member) AS members,
(SELECT COUNT(DISTINCT id) FROM thread) AS threads,
(SELECT COUNT(DISTINCT id) FROM post) AS posts

 

another way is to write down a Stored Procedure and asign every count to a variable. Then, return:

 

SELECT @count1, @count2, @count3

 

If the tables are related a succesive call to a left join would do the trick!

 

 

 

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next pagenext page

Import and Export Wizard with Identity Column

Share|I want to move data from one DB to another, while keeping the identity column...
article post

SQL Query – List Indexes

Share|—- SQL Query – List Indexes EXEC sp_helpindex...
article post

SQL Query – List Columns of table MS Database

Share|---- SQL Query - List Columns of table MS Database exec sp_columns...
article post

SQL Query – List the Fields in the Tables

Share|---- SQL Query - List the Fields in the Tables SELECT [name] AS [Column name] FROM...
article post

SQL Query – List the Tables in the Database

Share|---- List the Tables in the Database Select * from sysobjects where xtype in ('u',...
article post

SQL Script-COUNT from multiple tables

Share|There are many ways to aproach this (if the tables are not related): SELECT (SELECT...
article post

Devguru.in is Stephen Fry proof thanks to caching by WP Super Cache