How To Avoid Non-published Columns Deletion On Subscriptions' Reset
Apr 26, 2007
Hi all!
I have been doing some testing with transactional replication. I have a table (TEST) with the following columns:
[id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[name] [varchar](50) COLLATE SQL_Latin1_General_CP850_CI_AS NULL,
[stock] [int] NOT NULL CONSTRAINT [DF_Prueba1_stock] DEFAULT ((0)),
I want the table rows to have an independent stock value for each database. So,
I made a transactional publication with updatable subscriptions, to replicate all the table columns, except the stock column.
The problem is when I reset subscriptions: the table is deleted an created again on the subscriber, so all the data stored at the stock column is lost. I tried to solve this changing the "Action if name is in use" option at the publication. I choose to keep the current object without changes, but I began having problems with the generation of the identity values at the subscriber.
Obviously to delete all records from DB table is simple, however, I would like to make my whole Live DB pretty much empty. I've copied all my data from my test DB over to my live DB (didn't mean to but I did). I would like to remove all the data and the identity values, resetting them back at their original values. Is there a simple way or do I have to do it the hard way. That being going in and removing Identity, saving and then placing identity back on the DB Table.
In tables where reporting or historical information needs to be maintained I find that logical deletion of rows is better than actually deleting the row and any FK relationships. However when one of the columns in the table must be unique this introduces a problem because uniqueness only matters for "active" rows. I'm hoping someone can provide some advice on how to best handle this situation.
Here is an example to work from. Suppose we have a table that contains job positions. The table contains an IDENTITY column for the PK (to avoid duplicating position names), a Name column that must be unique and an IsActive column that is set to 0 when the position has been "deleted". This setup allows for historical reporting to properly pick up the position information even though it might no longer be used in a company. You can substitute your own scenarios here as there are quite a few.
Now if the Name column is marked as a unique column then the DB will enforce integrity which is what we want. However we will want to be able to "delete" a position but later add a new position with the same name. One could argue that we should just "undelete" the original position but that is not often a good idea so assume "undelete" is not an option. Given the unique constraint a new position could not be created if an existing position (active or otherwise) already existed with the same name. We could set up the unique constraint to include the Name and IsActive columns but now we are prevented from ever deleting two positions with the same name.
My initial thought is to create a new UniqueName column that is unique and remove the uniqueness constraint on the Name column. The UniqueName column is set (via a trigger) to the Name column when the position is active. When the position is deleted the trigger changes the UniqueName to include a timestamp or something to ensure uniqueness. This is handled by the system and not exposed to clients.
Any advice or alternatives on this approach (preferably with advantages and disadvantages)? Thanks.
Can someone please tell me how to retrieve/query the list of fields from an entity of a report data model that has been published on the reporting server programmatically ?
I am trying to upload a report data model to the reporting server and planning to use that model as the data source and consume it through our existing web application?
Can Ne1 tell me how to reset the auto increment colum of a table in the Microsoft Data Engine??, Does ne1 know where to find a free MSDE administration utility.
I have a demo database in SqlCE that I am getting ready to deploy. I deleted a bunch of test records and now want to reset the identity columns. The compact method runs fine, but the identity columns are not being reset? So when I add a new record, the returned identity value is over 1,000 even though the highest value is only 50.
[Production IDW [1]] Warning: Truncation may occur due to retrieving data from database column "Industry" with a length of 16 to data flow column "Industry" with a length of 8.
When I look at the industry lookup table the column size is 50. But the data flow metatdata is saying the oclumn is 8. How can I change the data flow column? When I try to edit it and click on metadata it is uneditable. The field it is matching to is 50 and the field it is coming from is 16.
i have a table with a few hundred columns. Each SELECT statement, I list each of the columns, this is taking lots and lots of space and it is difficult to review the code due to its length...Below, I have to list out every column when I only want to use case logic on 1 column. In the next step I will have to list out every single column again
SELECT ACCT1_NO ,ACCT1_DT ,ACCT1_RISK ,ACCT1_RISK_WEIGHT ,ACCT1_CUSTOMER_NAME ,ACCT1_CUSTOMER_ADDRESS ,ACCT1_CUSTOMER_ST = CASE WHEN ACCT1_CUSTOMER_ST = ' ' THEN 'DC' END ,ACCT1_CUSTOMER_CITY ,ACCT1_CUSTOMER_ZIP --,THIS CONTINUES DOWN FOR ANOTHER 150 OR SO ACCTS. INTO #A1 FROM STAGE.CUSTOMER_ACCTS
Is there a way I can tell SQL to take all of the columns and then list the column where I want to do my case statement. Something like the code below
(which will fail as ACCT1_CUSTOMER_ST will be listed twice. SELECT * ,ACCT1_CUSTOMER_ST = CASE WHEN ACCT1_CUSTOMER_ST = ' ' THEN 'DC' END INTO #A1 FROM STAGE.CUSTOMER_ACCTS
I need to create table in sql server 2005 database, I have plenty of columns. Well I know how to create them manually. but does any body know or tried before to create columns automatically, or through some batch process. I have column names already typed in TXT file (comma delimited).
Got a query taking too much time because of lack of cross columns MAX/MIN functions. Consider a similar example where a View is required to reflect distribution of Water among different towns each having four different levels of distribution reservoir tanks of different sizes:In this case the basic table has columns like:
Now suppose I need a query to distribute QuantityPurchased in the Four additional Columns computed on the basis depending on the sizes declared in the last four fields,in the same order of preference.For example: I have to use IIFs to check: whether the quantity purchased is less than Tank_A if yes then Qty Purchased otherwise Tank_A_Size itself for Tank_A_Filled
then again IIF but this time to check:
Whether the quantity purchased less Tank_A_Filled (Which again needs to be calculated as above) is less than Tank_B if yes then Tank_A_Filled (Which again needs to be calculated as above) otherwise Tank_B_Size itself for Tank_B_Filled
I doubt this is possible, but can someone think of a way to change the email address used for sending report subscriptions based on the report or subscription?
It's a need that I've heard from a number of different clients. Scenario: a company has one reporting services server with reports running from numerous departments. Report subscriptions are sent to internal and external email addresses and there's a business need to use different "from" addresses based on the report (or audience).
Sumanesh writes "Recently I read one article “Converting Multiple Rows into a CSV string�
(http://www.sqlteam.com/item.asp?ItemID=256)
I have found one easy and more efficient way to achieve the same thing. First I have a table called test with 2 columns (ID and Data) And some data inserted into it.
CREATE FUNCTION [dbo].CombineData(@ID SMALLINT) RETURNS VARCHAR(2000) AS BEGIN DECLARE @Data VARCHAR(2000)
SET @Data = '' SELECT @Data = @Data + Data + ',' FROM Test WHERE ID = @ID RETURN LEFT(@Data,LEN(@Data)-1)
END GO
Then used a simple select query to achieve the same
SELECT DISTINCT ID, [dbo].CombineData(ID) FROM Test
Which achieved the same thing without using any temporary tables and Cursors. I am sure that you will accept that this is more efficient than the one that has been published.
I'm getting the following error:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Here's the setup: I have a website I've published on my server, but I haven't moved the SQL DB over to the server. For some reason the testing server can't connect with sql express on my computer. I have named pipes, tcp/ip both on, connections string is "Data Source=AMBA-176SQLEXPRESS;Initial Catalog=pubs;Integrated Security=SSPI"When I'm simply testing the site locally in visual studio it can connect just fine.
Hi! I've added a column to a published table in the Publisher using SP_REPLADDCOLUMN. After doing this the replication triggers for that table(i.e. del_%,upd_%,ins_%) are doubled both at the Publisher and at the Subscriber. If i update anyone of the column in the table at the Subscriber; i get the following error:
Server: Msg 208, Level 16, State 1, Procedure upd_3E6DE124B82D42A5AEB169557C0D757C, Line 60 Invalid object name 'ctsv_3E6DE124B82D42A5AEB169557C0D757C'.
Any ideas, what has gone wrong????
I have the following SQL setup. Publisher: Enterprise Edition, SP3. Subscriber: Standard-Edition, SP3. The error is at the Subscriber.
I've been unable to determine why several published instances of my SQL Servers are not showing in AD. I searched under the Computer container in the domain in which the SQL Server was installed and did not see any SQL Server folder. I have used both the GUI and T-SQL to publish various instances, and it appeared to have worked since from the GUI the "Publish" option no longer worked and I recieved no error from Query Analyzer after issuing the command. The version is SQL Server 2000 8.0 running SP3a.
I also ran a VBScript to query the directory for published instances of SQL server, but did not get any results returned in the recordset. Any ideas?
it works when in debug mode, but after i depoly it to my XP's IIS, it can not login the database, the error message is :
Cannot Login to the default user database. Login Failed. Login Failed for user xxxASPNET
'xxx' is my computer.
i think this problem is cause of improper setting of security, but i really do not know how to set it in this situation, because the database is attached to the db system dynamically.
Good morning folks, I'm getting the above error message when trying to drop a table. I'm not to familiar with the setup of this SQL server, so I not sure if the replication is enabled. I have never had to use replication so I don't know to much about it. Does anyone know how I guess to remove this table from the replication list so that it could be dropped?
Is there any way or method to CHANGE the DATATYPE of a column in a published table being used for transactional replication (MSSQL 2000), WITHOUT DROPPING THE SUBSCRIPTION ????
Im stuck in this mess and do have the option to drop the subscription, alter the table, create the subscription and rerun the snapshot or to recreate it by Manual Synchronisation either.
Can anyone help? Has anyone been across this dilemma before and have troubleshooted the problem? If yes, help is much appreciated.
MY PROBLEM: ~~~~~~~~~~~~~ 'MyTable' is currently being published and has subscriptions to it. The PRIMARY KEY column 'id' has an Identity property as well. 'id' is of datatype smallint, however because of bad planning, i now need to change that datatype to an integer to support a larger range WITHOUT DROPPING SUBSCRIPTIONS. I CANT DROP THE COLUMN EITHER AS IT IS BEING THE PRIMARY KEY COLUMN.
IS THERE ANY OTHER WAY I CAN DO TO ARCHIEVE MY GOAL? THANKYOU.
Hi all,I'm using SQL Server 2000 SP3 to store data for real time transactionprocessing.I have set up replication to another server using a push subscription togive me immediate backup.I need to alter the data type of one of the columns and am using thefollowing basic sql:alter table Voucheralter column SerialNumber varchar(20) NOT NULLHowever I keep getting this error message:Server: Msg 4929, Level 16, State 1, Line 1Cannot alter the table 'Terminals' because it is being published forreplication.Is there anything I can do to allow this update taking place, short ofdeleting the subscription and recreating it. (I want to try and avoidthis as the same update needs to be applied to about 10 databases thatare also replicated in the same way).All help is appreciated.Brian.*** Sent via Developersdex http://www.developersdex.com ***
I am looking for some published paper regarding database performancetunning performance strategies. This is for academic purpose so itneeds not to be any commerical database specific. It will be evenbetter if the paper has some kind of methods to quantify/measureperformance. Has anyone come across with any interesting paper aboutthis?Thanks,ewong
Regarding to my previous post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=553652&SiteID=1, just wondering if there's a way to detect any changes which is made on the existing indexes in a published table so that the device can determine whether reinitialization of subscrption is needed before every synchronization.
I have been working on parameterised reports for quite a while and have a problem with a report that I cannot fathom despite days spent fiddling. I am hoping someone will be able to spot a silly mistake...
Basically, I am developing my report in VS2005 and it works perfectly. When I publish it to the reporting server I get an error: The 'pSite' parameter is missing a value.
I cannot understand why the report should fail when published.
Before anyone says it, yes I have deleted the published report and re-deployed so there should be no chance of any 'old' deployments messing things up!
Any obvious suggestions before I start posting code?!
I have been working with Visual Studio 2005 and the Personal Web Site Starter Kit. All is well and working. My problem is that after the database is updated (as in uploading photos and album creation) and the original web site is edited and republished, the web site database is overwritten and all the work is lost. What is the proceedure to either copy the web database to the development site on my computer so updates will not be lost, or a method of publishing that will not loose the up to date content on the web server? I would much prefer to be able to copy the database to my development computer as adding tables to the database is something that needs to be done. Any help on this would be appreciated.
I am nearing the end of creating my Windows App for work. So I tried to publish it, that was fine until I ran the app, from the same PC as I use to develop, with the same login etc. However when I use the published app I can't connect, to the database, return to VS2005 and run my app from within there and no problems. It is SQLEXPRESS (SQL Server 2005), but I have checked the settings there are correct (I assume VS wouldn't connect otherwise).
Server (Win2003) and my PC (Win2K) are on the same domain
Using TCP/IP
I can't see how to enable JiT debugging despite the 'help' at the end of this error details... See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at TrainTrack.frmAddCompetency.frmAddCompetency_Load(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.
When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
I have a data table called STOCKPE which holds stock valuation information at the close of business each day. I wish to use reporting services to extract the data in this table on a daily basis and keep a daily history on the report server. I know I can do this - this isn't my problem.
When I have the history of this table on the report server, can the data that the reports on the report server hold be used as a datasource for another report?
I'm no expert in reporting services, so if this is possible, or if there's a better way of doing it, please use small words and short sentences. No offence intended to all the very well educated SQLRS wizards out there, it's just that I'm not one of them and your answer will be lost on me if you use a lot of abreviations and acronyms.
I have a DTS package that I am calling in my code-behind (vb) of one of my asp.net pages on my intranet. The package takes a FoxPro table that is on our network and inserts it into a SQL Server table in one of our databases. The package gets called and executed properly when I am working on it in development on my local workstation, but when I publish it to our intranet, which is in the same domain and behind the same firewall, the package does not execute. No error shows up on the published page, but also nothing gets executed. Has anyone encountered this? Here is my code, which is pretty straightforward: oPkg = Server.CreateObject("DTS.Package")oPkg.LoadFromSQLServer("[servername]", "sa", "[password]", DTSSQLStgFlag_Default, "", "", "", "Invoice Import")oPkg.Execute() Any help would be appreciated. Thanks.
We have 4 SQL SERVER 2000 servers linked via replication, and due to business changes we have to add one table to the published databases. And the existed database has more than 20g, recreating the snapshot and re-init replication is not allowed as the business cannot be stopped more than 1 hour. So my question is how to add tables to the published article without recreating the snapshot?
By that is not possilbe, can we publish one new article on the same database?
I create a WebSite onto the internet. Then I created a database with MSSQLmanager provided by the WebHosting. I created a Table and put some data in it. When I try to access the DataBase an Error says: "Connection cannot be opened. On default settings you cannot access a Database Remotely." What shall I do to configure my Database. basically I don't know where to go to change configuration of my Database. In my intranet I would use SQLServerSuraceArea. But on Internet I do not know. someone Help. Did I miss something ?