Hi Guys, When iam trying to update the table with the field called "openstatus" is smallint . Iam trying to do following like this update table1 set openstatus=2 where openstatus=NULL But iam getting error like this:
"Syntax error converting the varchar value 'NULL' to a column of data type smallint." Could you please let me how to solve this proble. i really appreciate it.
hi i cant update the values in the table from data base if i do so an error message will show as below No row was updated . The data in row 37 was not committed. Error Source: Microsoft.VisualStudio.DataTool. Error Message: The row values updated or deleated either do not make the row unique or they alter multiple rows(2 rows)
HI, How to create package in SSIS by applying the business Logic like if the record already exist it should be and update else it should be an insert in the destination table. how to achive this funcality in SQL SERVER 2005 (Business Intelligence studion).
Hello, I want to update a field value with its default constraint value defined. how can i do that? Suppose if it is a Date field, my default date value is 1/1/2000 and currently it contains 6/18/2007, i would like to know how can we update this field with default value. Thanks for all your help, General Problem
I have table in that created column is there it has the data like 23 24 45 45 43 67 by mistake if i updated that column as 77 can we roolback to old date
Hi all, I am using the odbc connector to get a local table. I want that table to get populated every night automatically. How can i do that? Also i want to check if any existing record is updated/changed in the dsn database. Any help is highly appreciated. Thanks, Jeff.
Dear all, i've one database in my server namely mydb1, and another database mydb2. same type of tables are there. in those tables, when ever developers are entering data, that should be automatically updated here also. i think replication suits this.
daily maximum 200 transactions may occur in the mydb1.
if replication suits this, which replication can i use..and please guide me for the process....
and one more doubt...actually only 22 tables out 0f 1300 tabls will modify regularly... rest of those are not changed frequently...
Vinod Even you learn 1%, Learn it with 100% confidence.
Hello all i am trying to update the database with the DataSet (Updated from the DataGrid) but it is giving the error as "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." the code is as follows
public DataSet bindControlToGrid(DataSet dataSet) { SqlConnection objConn= null; SqlCommand objComm = null; try { objConn = new SqlConnection(@"User ID=sa;Password=sa;database=ExtraNet;server=EAGLESEAGLES");
SqlDataAdapter objAdapter=new SqlDataAdapter(); objAdapter.SelectCommand= new SqlCommand("SELECT sUserID,sUserName FROM tblUser WHERE dUserDeActivated IS NULL ORDER BY sUserName,nUsrSerialNo",objConn); SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(objAdapter); objConn.Open(); DataSet objdataSet= new DataSet("ko"); string d = (dataSet.Tables[0].Rows[0].ItemArray.GetValue(0).ToString());
I am updating a table in store procedure. I want to check whether the statement has successfully updated the table or not. i know in mySql i can handle it using ROW_COUNT() function. but how can i do it in MS-SQL?
€śI have a scenario where i am trying to insert 200,000 lac records & update 200,000 lac record in destination table using SISS Package (SQL SERVER 2005) but I am not able to neither update nor insert the records . while executing the package its not showing any error also . what could be the problem ? €ś
We have business logic in Package creation 1) Insert New records and 2) Update Existing Records using the follow Data flow diagram For update we are using OLEDB command, for insert we are using OLEDB Destination. We are using merge join for spliting record into insert and update.
I have a table having 1 column whose value have to update,the column is encrypted using symmetric encryption. Value in column is 0 in char form, I have to increment it, when retrieving it return 0 to increment i have to convert it to int,it becomes 48 after increment it is 49 after conversion to char it becomes 1. It is going right upto 9 after 10 it jumps to very large number on increment.
I am trying to set up Transactional replication with immediate updation.
The configuration is as follows:
1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the same server. 2. Publisher SQL server Standard Edition is installed on Windows 2003 with sp1. 3. Subscriber is an SQLServer 2000 Evaluation version on Windows Professional 2000 with sp2.
When I set up the Publisher with transactional replication with immediate updation only, the set up was successful. I subscribed 2 instances of SQL server from Windows 2000 professional on the local LAN in the same domain. The set up went fine.
When I update from the publisher end the updation is successfully replicating to all the subscribers. But when I try to insert any records in any one of the subscribers, I am getting the following error:
[Microsoft] [ODBC SQL Server Driver ][SQL Server ][DBNETLIB][ConnectionOpen(Connect()).] SQL Server does not exists or access denied.
I am beginner to this replication technology, but I have to set up in my organisation. Please anybody help me in figuring out the actual problem and resolving it.
I'm a VB.net programmer working in an environment that doesn't have a true sql db administrator. We have a situation where we're thinking about adding a new database (db2) with the same Tables used in an existing database (db1). We were hoping to avoid this, but circumstances are forcing us to think about it. Are there any sql tools out there to maintain a dual-db like this? What are the main disadvantages to this?
i need to create a rowset containing database names where a particualr table name exists. ie. in Oracle i would select owner from sys.all_tables where table_name='MYTABLE'
I know master.dbo.sysdatabases contains my owners, and in each database sysobjects would identify MYTABLE .. sp_tables only lists those in the current database, but i want to list all databases that contain MYTABLE
I'm quite new to MS SQL and am having a few problems I hope someone here can help me with.
I've created a small web application that enables users to backup and restore databases easily.
There is one table that holds information about the backups that have been taken and one table that holds details about each database (name, location etc)
What I want to do is have a web interface that allows a user to link a new database (one that is already attached to SQL but) to the system by inputting it into the database details table.
Ideally this will be a drop down menu that shows the databases attached to the server that arnt: 1. Already in the backup system table 2. Not the system databases.
This will allow the user to easily select the database and give it a title (usually different from the local name of the database) for identification.
The database local name, and title would then be input into the database details table.
I'm thinking that I need to use a SELECT statement, but I'm not quite sure how I can restrict the results to databases that arnt already attached or already in the system.
What is the best approach to handle this situation? I have three different databases, which has it's own stored procedure. I need to call them all at page load and piece together the data. The common demoninator is the date.
2007 JAN FEB MAR APR
row 1 50 60 89 63
row 2 44 21 62 46
2006 JAN FEB MAR APR
row 1 60 90 65 41
row2 984 650 452 762 Row 1 and Row 2 come from two different databases and stored procedures. How can I query the data and present it as it's shown above? Thank you!
Is there a query I can run to retrieve a list of all tables and their sizes in a database? I want something that is like the feature in Enterprise Manager when you click on a database and then the 'Tables & Index' link. It lists the tables and their respective size. I want to push this into a spread sheet.
The reason why I am doing this is the compare data between 2 different databases. Since I cannot find a tool that will compare the data, the closest I can get (without bcp-ing out all data and comparing) is to look at the sizes of each table.
Hi I have a problem out here. I have two databases with the same table structure and I want to merge data from both the tables . Please can anyone let me know. Iam using Sql Server 7.0.
I want to map a table1 in one database to a table2 in another database. That way I can populate the table2 with the information that table1 has. How would you go about doing this. Very new at this and need help! Thanks alot .
Hello EveryoneWe have a third party tool which maintains its own customdatabase,DB1 on SQL Server 2000 on Server A (Windows 2000). We built aninhouse application which maintains a transactional database, DB2 alsoon Server A derived from DB1. Since the DB1 is frequently updated thesynchronisation between the databases is currently maintained by usingviews in DB2 which pulls in all the required data from across tables inDB1.But we found that the cost of employing views, referencing tablesacross databases has made the inhouse application slower and so as aapparent performance tuning measure we plan to maintain a subset ofdata(for a specific time period) from DB1 in actual tables with sameschema in our transactional database DB2. But since the tables in DB1are frequently updated during the day we are required to thesynchronise the corresponding tables in DB2 with their counterparts inDB1. The only constraint in this synchronization being that the thirdparty custom database,DB1 cannot not be subjected to any changes (likecreation of triggers) as it is maintained by a different group ofpersonnel.I read about Triggers,Maintenance Jobs and Replication but not surewhich would suffice our needs.Are there any recommendations on how thiscould be carried out? Any suggestion would be welcome.Thankschandra
I have several databases that are used to collect data for differentclient-projects. My intention was to collect the data, and administermySQL so each client could see only their data. Each of thesedatabases used to collect data have the same tables. There are otherdatabases which are available to all the users which contain commoninformation.The command "show databases" lists all of the databases (visible tothe particular user) and not the one's I would like to display (thedatabases used to collect data). Is there a way to nest a singlemySQL command to show only the databases that have the same particulartable?
In a package we have statements pointing to 2(or more) different databases on the server. When moving between environments, is there an easy way to change statements like:
UPDATE t1 SET t1.name = t2.name, t1.age = t2.age FROM DB1..Person t1 INNER JOIN DB2..PersonToo t2 ON t1.PersonID = t2.PersonID
I can think only of building the statements replacing the database names with variables, but that's not an easy way. I do not know how to use package variables in this situation. 1 way of doing this may be by using a Lookup or Conditional Split and use the resulting dataflow in a SP or such to update, using parameters... It all sounds very messy, and I still don't know how Any ideas?
Hi everybody. I need to find all the views that depend on a table in a different database, in order to refresh them once the table is altered.
In the BOL I found the following script that is very useful, but I can't use it if the view and the table are in different database. Where can I find the dependencies in this case?
Thank you very much.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/9ce1d07c-ee66-4a83-8c73-cd2cc104dd08.htm Creating a script that updates all views that have dependencies on a changed object.USE AdventureWorks; GO SELECT DISTINCT 'EXEC sp_refreshview ''' + name + '''' FROM sys.objects so INNER JOIN sys.sql_dependencies sd ON so.object_id = sd.object_id WHERE type = 'V' AND sd.referenced_major_id = object_id('Person.Contact')
Here's something that I need to do. Might be pretty simple for you guys. :)
I have a table of Employees. All the employees work in some departments. So, I have a table of Department too. Employee table consists of details like EmpID, FirstName, LastName, SAP etc. Dept table consists of TeamID, TeamNo. Now, I have another table called as Emp-Team. This table basically maps the employees to the department by taking EmpID and TeamID. There's one more column in this table which is date. This date is required because when some person resigns (say today) then he won't feature in the headcount for July 08 but till June 08 he was there and this is how I maintain my history. e.g All the employees in the Emp_Team table have date as 01/06/2008 for this month. So, in future if I query for the employees who worked in June I will get this list. Now, I want to copy all this data in the same table again and want to remove any people who have resigned. Their resignation status is in the Employee table, where you have their last working date as well. So, when I add all this data with date 01/07/2008 I want to remove any employees whose last working date is before that.
Can this be done or I have to change my design? In case it can be - How?
I am very well versed on manipulating data using passthrough queries through access or the command object in ADO/VBA but this problem requires a sql server side solution and I have been assigned the task
Scenario
Access via an ODBC link cannot view Sql table data that uses a BigInt as a primary key. Access can update the data, insert data ands delete data to these tables - but viewing (by design) returns the actual count of the rows but each field is populated with #deleted.
I can view the table data if I use a passtyhrough query but performing row level and field level edits from there is impossible. Not all people have Studio manager so that is not an option.
We are moving away from our legacy application and the development company has already developed the schema using the BigInt so changing that to a numeric or integer is out of the question. My boss has determined that using a set of bridge tables with identical tables in a different database where we replace the bigint with int will work - we can view the data in the "bridged" database and even update it from select queries and simply by opening the table in view mode from Access.
Here is the hard part (for me) because I have never done this. I can write SQL and understand the security/roles etc, but I have never administered SQL server regarding server side triggers and stored procedures - I have always used the command object or passthrough queries to deal with sql stored procedures. I need to either
A)Create some trigger behind the tables in my bridge table that will fire a stored procedure to replicate the data to the bigint database. They are both on the same sever.
B)Somehow create a "mirror" that always replicates from my bridge database tables (5 of them) to the new database.
HiOur product uses MS-SQL Server 2000. One of our customer has 10installations with each installation stroring data in its own database.Now the customer wants to consolidate these databases into one and wealready have plan for that by consolidating one DB at a time. But firstthey want to find how many unique or duplicate entries they have acrossall the 10 databasesAssumptions:1. All the databases reside on the same server. (This is just anassumption, not the real environment at customer site)2. Databases can not be merged before it is found how many unique orduplicate rows exist.Table under consideration:Message(HashID PK,....)# of rows in Message table in each of databases: 1 MillionHere is my question: How can I find how many unique or duplicateentries they have across all the 10 databases. I easily find uniquerows for two databases with a query like this:SELECT COUNT(A.HasID) FROM db1.dbo.Message A LEFT OUTER JOIN ONdb2.dbo.Message B ON A.HashID = B.HashID WHERE B.HashID IS NULLHow can I do this for 10 databases. This will require factorial of 10queries to solve this problem.I will appreciate if someone can provide hint on this.RegardsAK