SQL 2012 :: DB Setting That Affects DBCC Checkident (reseed)?

Apr 23, 2014

I have encountered an anomaly. The dbcc checkident(reseed) command behaves differently on two SQL servers.

In both cases, I am deleting from (not truncating) data in two tables, due to foreign key constraints. (I am truncating other tables, the issue is not with those tables, only with the deleted-from tables.) On one server, I need to use dbcc checkident(reseed,0) so that when I insert fresh data, it begins with identity key #1. According to MS documentation, that appears to be the correct behavior, when data has been deleted from a table, rather than truncated.

However, on the other server, I need to use dbcc checkident(reseed,1); if I use ...(reseed,0) on that server, it begins inserting data with identity key #0.

This is consistent, repeatable behavior on both servers.

View 4 Replies


ADVERTISEMENT

DBCC CHECKIDENT (jobs, RESEED, 30) Does Not Work

Jan 26, 2007

Hi,

I'm trying to set up merge replication and when I try to synchrinize with the subscriber I get the error "invalid column name ROWGUIDCOL". Following an article it recomended to reseed the identity columns on the subscriber so that there is no conflict. Now the tables with the identity column have the "Not for replication "option on. Using DBCC CHECKIDENT (table_name, RESEED, some_value) does not change the SEED when I check. SQL server help file remarks on DBCC CHECKIDENT say that if the column was created with the "Not for replication " option on it cannot change the value.

From sql server help file:
Remarks

If necessary, DBCC CHECKIDENT corrects the current identity value for a column. The current identity value is not corrected, however, if the identity column was created with the NOT FOR REPLICATION clause (in either the CREATE TABLE or ALTER TABLE statement).



Any way around it or any help so I dont get that "invalid column name ROWGUIDCOL" error?

Thanks allot. Looking forword

George

View 7 Replies View Related

Dbcc Checkident

Jun 27, 2007

Dear All,

I'm trying to run the DBCC CHECKIDENT procedure to reset identity seed to 1 as I need it in a temp table I create in a stored procedure.

Is there a way of running this procedure or one which resets identity seed under an account which is not part of the sys-admin group?

View 4 Replies View Related

Running DBCC CHECKIDENT Command Within Stored Proc?

Jun 17, 2015

For reasons beyond the scope of my question, is there a way to run this command within a Stored Procedure from a low privileged user login? I can grant the entity "db_ddladmin" privilege and the proc runs, but I'd rather not give out that level of permission to what is basically a glorified web access login.

View 5 Replies View Related

DBCC CHECKIDENT Atomically Change Identity Seed?

Aug 9, 2007

I have a set of staging tables that need to be used to update a hierarchy of tables with foreign keys between them, and identity columns for the primary keys. One way I'm thinking of doing this is to reset the identity seed on the target tables based on the number of rows I have in the staging tables, then to update the staging tables keys to match the vacated range of identity values. I'd insert them with SET IDENTITY_INSERT ON.

The question is: can this be done atomically? It seems that DBCC CHECKIDENT will return the current identity value, but can only change the seed to an absolute value. That would require that I get the current value, add "n" to it, then set the seed value. This would seem to be non-atomic, in that a new row could be inserted between the time I find the "current" value and the time I set the new value.

Does anyone know of a way to pre-allocate a block of identity values atomically? This has to be done in a live OLTB database.

View 4 Replies View Related

SQL 2005 && Reseed

Jun 7, 2008

I have 2 identical databases.  In DB1 there is no data.  DB2 some of the tables have data. DB1 updates DB2 but just for demonstration purposes I need the ID fields to match (identity fields).  So I ran a script to reseed all the tables in both databases.
In the database, in tables with NO records, some start at 100 and some start with 101.  Help!  It's driving me craz!
EXEC sp_MSforeachtable 'IF OBJECTPROPERTY(OBJECT_ID(''?''), ''TableHasIdentity'') = 1 BEGIN DBCC CHECKIDENT (''?'',RESEED,100) END'

View 3 Replies View Related

Reseed The Identity Column

Oct 25, 2005

Hello there,
I am having problem in modifying the identity column of a table.

Currently the identity column is seeded by 1 with an increment of 1 and DATA with these properties of the column is stored.

Now, I want to reseed the identity column with an increment of 2.

The query I am using is

ALTER TABLE XP ALTER COLUMN XP_ID BIGINT IDENTITY ( 500, 2 ) NOT NULL

Is there any one out there who can help me?

View 5 Replies View Related

Check Ident Reseed

Sep 16, 2006

Reseeding in SQL Server gets different results based on whether the table has ever had data in it.

ref: http://cs.thycotic.net/blogs/bryant_smith/archive/2006/01/17/65.aspx

I am having the same problem. Any suggestions ?

View 1 Replies View Related

Reseed The Identity Column With Trigger.

Oct 26, 2005

I need to populate a temporary holding table from a trigger. The contents of this table will be added to another table when the Trigger has completed processing. The id column of the temporary table will be added to the max value in the final table to create the record identifier. I used an identity field in the temporary table to accomplish this. My initial idea was to create a temp table in the code for the trigger then drop the temp table when each recursion is complete. However I got "cannot use Create table in Trigger". Then I tried to make temp table in stored proc called by trigger. Same message. Then made permanent "temp" table, and tried to Trucate table after each use. I got "Cannot use Trucate Table in Trigger". Finally I used delete from and DBCC Checkident to reseed identity. This worked in Query analyzer. I worked in VB project using ADO. However, I after deployment I was informed that VB project using RDS to make and update ADO recordsets was failing to run the trigger. After troubleshooting I was alerted that DBCC CheckIdent can only be run by table owner. Business rules prevent this. Therefore I would like to know if anyone knows any other way to reseed an identity, before I abandon this approach and start over.

Thanks for trying.

View 9 Replies View Related

SQL 2012 :: Optimal Settings For DBCC Checks?

Aug 5, 2014

I have a VM set up for offloading DBCC checks. Specs are below. I've read through this, but I'm not seeing the performance gains by enabling the trace flags and using the physical only switch.

Is the whole drawback that I'm on SATA storage? Is there a VM configuration with the CPU I can/should change? I've been playing with MAXDOP trying to see if I can get any benefits but I'm not seeing a much.

wait_type wait_time_spctrunning_pct
CXPACKET 561191.4228.7128.71
OLEDB 387136.7619.8148.52
PAGEIOLATCH_SH 340674.5817.4365.95
TRACEWRITE 321598.8416.4682.41

[code].....

View 9 Replies View Related

SQL 2012 :: DBCC CHECKDB Runs On All Our Databases

Dec 2, 2014

Every night all our DBCC CHECKDB runs on all our databases. The trouble is one of them is very large and the database is inaccessible whilst this runs. DBCC CHECKDB (dbname) WITH physical_only executed by user found 0 errors and repaired 0 errors. Elapsed time: 0 hours 24 minutes 46 seconds

This normally happens fairly shortly after the backup, and normally (but not always) after a series of these entries in the log.SQL Server has encountered 7976 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [D:Program FilesMicrosoft SQL ServerMSSQL11. MSSQLSERVERMSSQ LDATA empdb.mdf] in database [tempdb] (2).Would this cause SQL to automatically run a CheckDB.

View 9 Replies View Related

SQL 2012 :: Rollback Of DBCC CheckDB Stuck

Oct 6, 2015

DBCC CHECKDB was affecting performance. Screens were hanging, timeouts, etc.

So I made the unfortunate decision of Killing the 2 processes.

I keep checking the percent complete and they are stuck at 33% and 17%.

Will I have to restart the SQL Server Service?

Are they any other options?

View 3 Replies View Related

SQL 2012 :: DBCC CHECK DB Outcome - DB Refresh

Oct 22, 2015

I created sql job using maintenance plan to run DBCC Checkdb for all databases. But I didn't choose the option Ignore databases where the state is not online. If any db is restoring the same time as DBCC Check db job running, is check db job fails?

View 1 Replies View Related

SQL Server Compact - ReSeed Identity Column

Feb 21, 2008

Is there a way to reseed the Identity column in SQL Server Compact Edition? The following command does not appear to work DBCC CHECKIDENT (Table_Name, RESEED, 0) and I cannot seem to TRUNCATE the table either. Not sure if table truncation is even supported.

View 5 Replies View Related

SQL 2012 :: Use Of Running DBCC Free Session Cache?

Feb 12, 2015

What is the use of running DBCC FREESESSIONCACHE.

How frequently can we do this on all the databases.

What happens if we schedule to run it every 1min.

Are there any advantages/disadvantages of running this on all databases.

View 5 Replies View Related

SQL Server 2012 :: How To Determine Metadata On DBCC Results

May 26, 2015

I can find many examples of loading DBCC results into tables. They all begin with a create table statement defining the results. My question is , other than trial and error, is there a way to determine what data types will be returned. Sure you can say that first element looks like an integer, but is it really a bigint, and that text string can be varchar(max) but will char(2) work.

I'm not looking for an answer for a specific DBCC function, but rather a generic way I can determine the characteristics of any DBCC result set.

I tried

SELECT *
INTO #tmp
FROM OPENROWSET('SQLOLEDB',
'Server=ray;Trusted_Connection=Yes;Database=Ed_sandbox',
'Set FmtOnly OFF; DBCC loginfo WITH tableresults ')

but I got back

Msg 11527, Level 16, State 1, Procedure sp_describe_first_result_set, Line 1

The metadata could not be determined because statement 'DBCC loginfo WITH tableresults' does not support metadata discovery.

View 1 Replies View Related

SQL Server 2012 :: Run DBCC Inside Stored Proc Using EXECUTE AS

Mar 18, 2014

I am a SysAdmin on a test/dev SQL instance. Other non-sysadmin users (developers) need the ability to execute DBCC commands like the following:

DBCC FREESYSTEMCACHE ('ALL') WITH MARK_IN_USE_FOR_REMOVAL
OR
DBCC FREEPROCCACHE

I tried creating a store proc in a user database and granting those non-sysadmin users EXECUTE permission on it as so:

CREATE PROC spFreeSystemCache
WITH EXECUTE AS 'sa'
AS
DBCC FREESYSTEMCACHE ('ALL') WITH MARK_IN_USE_FOR_REMOVAL
GO

When I try to create this proc, I get the following error:

Msg 102, Level 15, State 1, Procedure spFreeSystemCache, Line 2
Incorrect syntax near 'sa'.

Ok, so I can't EXECUTE AS sa...

View 5 Replies View Related

SQL 2012 :: DBCC CheckDB Output File With Date Stamp

Jul 8, 2015

I would like to know if it is possible to date stamp the output file for the DBCC integrity check?

The following cmd works fine however I tried different ways to date stamp the output file with no luck.

sqlcmd -U backup -P Password -S Server -Q"DBCC CHECKDB('DatabaseName') WITH ALL_ERRORMSGS" -o"G:LOGSDBCCResults.txt"

View 5 Replies View Related

How AD Affects SQL Server2000/2005

Dec 5, 2007

hi
at my work place some of the users migrated to another domain even thought with new domain name they can access SQL Server but user who are part of sysadmin(part of some group) on the box unable to execute a job. it means at operating system level newdomainuser credentials are get resolved that's why users are able to access box but why not able to execute jobs. why sysadmin Privilege not get resolved at SQL Server level very confused............

View 7 Replies View Related

SQL 2012 :: AlwaysON Setting Up A C Node?

Apr 28, 2014

I have an A & B node set up and running. I now want to add a C NODE.

The catch is the C NODE is in a SQL Cluster Environment.

I am guessing I add the Virtual Name of the C node to the current Always ON Cluster?

I tried adding it...the error message says" the Virtual Node is really the A node and to add the A NODE"?

View 6 Replies View Related

Stopping SQL Services Affects Users ?

Oct 12, 1999

If I stop MSSQLServer service on my SQL7 server using net stop and then restart it seconds later with net start, how will this affect my users ? Will they notice this ? Gets disconnected ?

The reson is to memory recycle my server.

..Harold

View 6 Replies View Related

Viewing A SQL Statment's Affects Before Commiting

Jun 22, 2007

Hi all,

I work fo ra company which doesn't have a test database.

Is there any way of viewing the changed to records an SQL statment will make before commiting it?

Thanks

Dave

View 2 Replies View Related

Changing XP Password Affects SQL Server?

Apr 27, 2006

hi folks,

has anyone experienced this issue?

When one changes the login password for XP, all the SQL Server groups are removed the next time you log into SQL Server 2000.

Is this a bug or a security feature, is there any way around it?

thanks for any help!

View 11 Replies View Related

Author Of Package Affects Login?

Apr 23, 2007

This is a very frustrating problem.

Let me break it down for the reader.

I have an agent service account that works fine - the account that jobs run under.

I know it works fine because this is the same account all my SQL Backup jobs run under - without a hitch.

I also have a valid sql server account that I use for connection string logins when building packages -

that account works fine. I know it works fine because I can login to the SQL Server Manager with this account.



So, I build a package with the sql server account and password for the OLE DB connection manager in a package. All the package does is a simple query on a table and outputs to a flat file.

I create a job, with 'sa' as the owner. in step 1 I select SSIS package, run as SQL Agent Service Account, package source is file system and I point to the package. The package itself uses the sql server login account to execute.



If I run the package it works fine. I close the solution, someone else comes along and opens the solution - THEY CHANGE ABSOLUTELY NOTHING ABOUT THE LOGIN OR SQL AGENT SERVICE ACCOUNT, but apparently just the fact that they opened the solution and looked at the package, breaks the login. If they try to run the package, they get a login failure, whereas I did not. After they close it, it breaks for me as well. If they open the solution, open the connection manager, re-enter the sql login's password, the package works fine for them, until I come along and open the solution, then it is broken again.



This makes no sense to me. Why would an 'author' opening a solution impact the connection manager when ABOLUTELY NOTHING ABOUT THE CONNECTION MANAGER WAS CHANGED?!



Seems like a bug to me. Anyone seen something like this?



Thanks in advance.



randy

View 4 Replies View Related

SaveCheckpoints=True Affects Recordset

Jun 16, 2006

I have a package that creates a recordset in a variable (Type=Object, Name=CountryTable).  The recordset is then picked up in a Script Task and loaded into a table using this code:

        Dim adp As New OleDb.OleDbDataAdapter
        dt = New DataTable

        adp.Fill(dt, Dts.Variables("CountryTable").Value)

It was working fine until I turned SaveCheckpoints ON.  Now it does not load any rows into the dt table. The dataflow task with the recordset destination ('CountryTable' variable) reports 10 rows in the pipeline.  If I turn SaveCheckpoints OFF, it fills the dt table OK.  If it cannot fill the dt table because of SaveCheckpoints being ON, shouldn't it give an error message?  Thanks.

Note: I have SP1 installed.

 

 

View 4 Replies View Related

SQL 2012 :: Setting Log Shipping In AlwaysOn Environment

Jan 23, 2013

We have 4 Servers which have SQL SERVER 2012 and "AlwaysOn" have been enabled on all 4 servers:

Server1,Server2,Server3,Server4

Server1 is the Primary node and thr rest are secondaries. There is a Sync relation between Server1 and Server2 and also there is aSync relation between Server1 and Server3 & Server4.

Is it possible to setup log shipping from Server2 & Server3(secondaries) to two new servers?

View 9 Replies View Related

SQL 2012 :: Setting Up HADR Between Two Stand Alone Servers?

Apr 23, 2014

how I can set up HADR between two stand alone servers? Is it even possible to set up WSFC between these two servers?

View 3 Replies View Related

SQL Server 2012 :: Setting Up A Process For The Dataload

Jun 23, 2015

i am setting up a process for the dataload, external windows service insert a record to dbo.dataload table with a status as 'Ready'

create table dbo.dataload
(Xmlcol xml
,Loadstatus varchar(15)
,Starttime datetime
,completedtime datetime)

now i use a SQL job to check the status column, pick xml and load to appropriate tables. instead of SQL job can i use a trigger whenever there is a insert it fires sp to load data would there be any disadvantage.

View 5 Replies View Related

SQL 2012 :: SSRS Security Setting / Can't Get Them On Report Level

Aug 11, 2014

I work on test SSRS setup and trying to give one user enough rights so she can download RDLs from server, but no matter what I do on Folder leverl, on report level her security are still only as a <Browser>. Structure of our Server is:

Home/NewReports/Misc/Report01.

I'm checking those in <Folder Settings>/<Security> where this user is OK (Browser, Content Manager, Publisher, Report Builder).

So she looks OK in all folders Home/NewReports/Misc, but on report level she still only a browser.

Our db team tried everything on SSRS server working with Site settings and Folder option, how to make that report inherit security ?

View 3 Replies View Related

SQL7: Order Of Values In IN Clause Affects Results

Dec 14, 1999

Hi!
Has anyone experienced this problem?
Certain queries that work fine in SQL 6.5 and Oracle return inconsistent / inaccurate results in SQL 7 (with SP1). These queries include an IN clause with a range of values.
For example, the following query:
SELECT columnA, columnB, columnC, columnD
FROM table
WHERE columnD = 'I'
AND columnA IN (1,2,3,11,19)
go

returns a different result than this query:
SELECT columnA, columnB, columnC, columnD
FROM table
WHERE columnD = 'I'
AND columnA IN (1,3,11,2,19)
go

The only way we have stumbled upon to get accurate results consistently is to order the range values from largest to smallest:
AND columnA IN (19,11,3,2,1)

Have not seen this documented anywhere. We are in the process of re-ordering these ranges in our code, but I welcome any ideas or comments...
Thanks!

View 2 Replies View Related

SQL 2012 :: Setting Up Transaction Replication In Test Environment From Production

Mar 3, 2015

Setting up Transaction Replication in test environment. I am willing to bet that most of you take a production backup (if so, how, and using what?), restoring the database to your test environment, then running a snapshot to your subscriber and away you go.

But perhaps you take a backup of your publisher and subscriber, if so, how do you know there are no inconsistences because there were transactions sitting on the distributor?

What do you do if you have additional indexes on the subscriber for reporting, that are not on the publisher?

Here at work we are having issues with getting consistent databases set up with T Rep, missing rows, duplicate keys at subscriber etc. How to avoid these issues.

View 0 Replies View Related

SQL 2012 :: Does Setting A Database Offline Free Up Resources On The Server

Jun 25, 2015

I have about 50 databases that are only accessed once a month and on a predictable schedule. Would it free up resources on the server if they were kept offline and brought online only when needed ?

View 8 Replies View Related

SQL 2012 :: Query Based On Column Name / Setting Up Database Table

Oct 30, 2015

I have a set of data spread across a number of tables regarding stock market data. An example of this follows:

Market Capitalization...

Date CompA CompB
01/01/11 100 5
02/01/11 102 4

Share Price....

Date CompA CompB
01/01/11 100 100
02/01/11 101 99

Event Data...

Date Company
01/01/11 CompA
02/01/11 CompB

Pretty simply, I need a way to retrieve the market capitalisation and share price data based on the event data. So for instance I say 'oh, there is an event on the 01/01/11 involving company A, the market capitalisation on this day was 100, then for the next event it was 4 for company B.

I can also transpose the data so that the company name is in the rows and the dates in the columns for the market cap and share price tables, but this leads to the issue that when I try and get the data, I don't know how to query the correct company for that date.

For instance:
SELECT Event.Date, Event.Company
FROM Event

how do I now say.....

SELECT MarketCapitalisation.Column
WHERE Column = Event.Company
AND MarketCapitalisation.Date = Event.Date.

I have played around with a few basic joins, but I am having issue with the principle of that second to last line of SQL (so only getting the correct column).

I still have a copy of the data in excel so can flip things around as needed, but that would only mean that I would have the issue of WHERE Column = Event.Date instead of Event.Company.

View 1 Replies View Related







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