Change PrimaryK &ForeignK Value Simultaneously
Apr 4, 2008Hi, can anyone help me with this? I need to write a proc to update all the tables in database with EmpNo where Employee is the master(Parent-table).
View 1 RepliesHi, can anyone help me with this? I need to write a proc to update all the tables in database with EmpNo where Employee is the master(Parent-table).
View 1 RepliesHas anyone developed a workaround to have SQL 6.5 and SQL 7.0 simultaneously active on the same NT 4.0 Server host. The use of VSWITCH.EXE to switch between SQL 6.5 and SQL 7.0 in not an acceptable solution. There are several applications that are only supported under SQL 6.5 and will not be upgraded to SQL 7.0 for another 3 to 6 months.
There are other applications (ERP and data mart) that were developed specifically for SQL 7.0 to take advantage of its new DTS, OLAP, and query capabilities.
All these applications need full-time access to their respective databases.
The obvious solution is to host SQL 6.5 and SQL 7.0 on separate servers. The client has a "monster" database server which would be too expensive to duplicate. Using a "standard" PC to host SQL 6.5 would significantly compromise performance of those applications.
Any advice or suggestions would be appreciated.
Andrew Dominguez, IMS
ajd@cwix.com
909.625.4066 / 7826 fax
Hi,I have managed to create a second copy of my "live" database, forsoftware testing purposes.Inspecting the properties of the new database, everything seems inorder. The logical file name is the same, which I believe is fine, andthe physical database (and log file name) is different.However, despite the fact that there is no application currentlyaccessing the "testing" copy, both databases are seemingly beingupdated simultanously. I can tell this from the physical file sizes onthe server, which are identical, and growing at the same rate.Does anyone have any suggestions why this might be happening - and howI can stop it?Thanks in anticipation!Phil
View 1 Replies View RelatedHi all,
I need SQL Server 2000 on the server, where SQL Server 2005 has been already installed. So I install SQL Server 2000 Instance as Named one. And everything is ok now when I connect locally from that server (SQL Server 2000 Instance is accessable both in SQL Server 2000 Enterprise Manager and SQL Server 2005 management Studio) and Default (SQL Server 2005 Instance) also works. But when I try to connect from SQL Server 2005 Management Studio (located on the other server) - only default instance is successfully connected, the named one - give an error:
TITLE: Connect to Server
------------------------------
Cannot connect to SERVERAMED_INSTANCE.
------------------------------
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
so I think smth wrong with using ports simultaneuosly.
For SQL Server 2005 Remote Connections are allowed both for TCP/IP and Named Pipes.
Default TCP Port: 1433
In SQL Server 2000 I didn't find where to allow remote connections.
After insallation in Server Network Utility - default TCP port - 0, in Client Network Utility - 1433.
I have already tried to replace 0 with 1433 - nothing changes,
and use 1434 both in Server and Client Network Utility - nothing changes.
I need a remote connect to SQL Server 2000 Instance.
I hope the answer exists. Thanks to any ideas.
Hi,
I have requirement where I need to show the table sizes of each table in database. For this, I have written a procedure that finds the sizes and loads into a table.
In my report, I should be able to run the procedure and select the rows from the table that I loaded the data into.
Is this possible to run the SP and then run query to get rows when a user clicks view report?
Dear All,
I am not an expert on T-SQL and I am trying out a small project to learn.
I
have encountered a problem, whereby I have 2 tables, 1 containing the
header (header_id, header_file, admin_menu_id and admin_submenu_id) and
then I have another table called header_details, where I am storing the
language details for this header, with the fields being
(header_details_id, fk_header_id, header_alt, header_caption and
fk_language_id)
Now I want to create a stored proc, first to
insert the header and then the header details. I also want that if the
header or header details already exist, I just do an update on these
tables.
I tried the following code but its not working:-
ALTER Procedure [dbo].[INSERT_Header]
(
@admin_menu_idint,
@admin_submenu_idint,
@header_filevarchar(150),
@header_altvarchar(150),
@header_captionvarchar(200),
@language_idint
@outIDint OUTPUT
)
AS
BEGIN
-- First do a select on the header table to see if this header already exists
DECLARE @count integer = 0
SELECT COUNT(*) as @count
FROM headers
WHERE[fk_admin_menu_id] = @admin_menu_id
AND[fk_admin_submenu_id] = @admin_submenu_id
--if it exists, then update this header
IF @count > 0
BEGIN
UPDATE [headers]
SET [header_file]= @header_file
WHERE [fk_admin_menu_id] = @admin_menu_id
[fk_admin_submenu_id] = @admin_submenu_id
ELSE
-- Insert header in header table --
BEGIN
INSERT INTO [headers]
([header_file]
,[fk_admin_menu_id]
,[fk_admin_submenu_id])
VALUES
(@header_file
,@admin_menu_id
,@admin_submenu_id)
-- Get the Inserted Header ID --
SET @outID = SCOPE_IDENTITY()
END
-- Now do a select on the header_details table to see if this header with this language already exists
DECLARE @count_details integer = 0
SELECT COUNT(*) as @count_details
FROM header_detail
WHERE[fk_admin_menu_id] = @admin_menu_id
AND[fk_admin_submenu_id] = @admin_submenu_id
AND[fk_language_id] = @language_id
--if it exists, then update this header
IF @count_details > 0
BEGIN
UPDATE [header_detail]
SET[header_alt]= @header_file
,[header_caption] = @header_caption
WHERE [fk_header_id] = @header_id
[fk_language_id] = @language_id
ELSE
-- Insert header in header table --
BEGIN
INSERT INTO [header_detail]
([fk_header_id]
,[header_alt]
,[header_caption]
,[fk_language_id])
VALUES
(@@out_ID
,@header_alt
,@header_caption
,@language_id)
END
END
Can you help me out please?
Thanks a lot for your help and time
Johann
Hello,
I have 2 tables EmployeeA(Eng) and EmployeeB(Spanish) kept in seperate mdb's. I want to add the records into Sql Server 2005 table called StateEmployee.
Procedure:
1. Loop through 2 folders..one containing table EmployeeA in mdb and other containing tbl EmployeeB in diff mdb's.
2. Pick a file from EmployeeA and EmployeeB, both at the same time.
3. Count the total no of rows in both files. If equal proceed.
4. Compare the 'employeeid' of one row of employeeA to the employeeid of EmployeeB.
5. If employee id matches, load both the rows in Sql server else file it to the error table.
6. Loop through all rows simultaneously till end of row.
7. Go to next mdb.
How do i go about this step by step. I am fairly new to SSIS.
I have seen information on the web about running two versions of SQL at the same time on the same server but was wondering any tricks of the trade regarding it. The main recommendation that I have seen is to have SQL 2000 SP4 running first as the default instance (which is my current situation on a development server) and then install SQL 2005 as a named instance on it. Should the SQL 2005 installation place its files in a dedicated directory (ie, C:SQL2005) as opposed to the default directory that the installation would normally write to, thus not overwriting any SQL 2000 system files? Any other recommendations?
View 1 Replies View RelatedHi,
I'm using ASP with a JScript variant and MSSQL Server 2000. I would like to write a script that basically erases all data except for a few things.
Is there a way to update multiple tables at once without having to write lines and lines of code? I tried UPDATE tbl1,tbl2 SET uid='asc', but to no avail. It gave me a syntax error. My thinking behind it is something like... UPDATE dbo.* SET uid='mferguson' and after that I can delete stuff like DELETE dbo.*... Any ideas?
I know the above is ASP, I've tried this thread in the ASP forum with no avail... they referred me to this forum.
Is it possible to restore two databases simultaneously in same sql instance?
View 3 Replies View RelatedIs there any problem with implementating some kind of replication andbacking up transaction logs at the same time? SQL Server 2000 StandardEditionThe server is configured to back up log files regularly, with thepresenceof a(New) Disaster recovery server and with an inability forstandby(Standard Edition)I am planning to implement some kind ofreplication hopefully still backing up the transaction logs to enablea point in time recovery.Thanks in advance for your great ideasVincento
View 1 Replies View RelatedHi!
Is it possible to have both servers installed and not having issues?
I am really new to this.
At my company we have both installed. At home I created a backup of a database in SQL Server 2005 but can not restore it here were we have both.
The message I got is: System.Data.SqlClient.SqlError: The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.
So I think it seems that even though I'm trying to restore it in 2005 this version still uses the old server or something.
I hope I made it clear enough.
Please help.
Thanks.
We are currently using Crystal reports but are considering using SQL RS. We need to know if there is a restriction on simultanoeus access to the same report by multiple users? What happens when multiple users try to access the same report simultaneously? If reports can be accessed simultaneously, do the requests queue up or are they processed concurrently?
Any help on this issue is greatly appreciated.
I have two table both say A and B.If i insert a record in A that record should be inserted in B.If i delete a record in A that record should be deleted from B.Is that possible.If yes please tell me.Thankyou in advance,vishnu
View 3 Replies View RelatedAlright, here's the deal. I'm testing some backup/restore strategies, and hitting a (slight) sticking point.
We've got collections of database and log backups created by the usual maintenance plans on a 2000 Enterprise machine. I'm trying to run through a restore onto a new 2005 machine (Developer Edition on my test workstation) using the collection of .bak and .trn files copied from the 2000 server. When I try to restore to a new database on 2005 via SSMS, and select all the .bak and .trn files for the restore, I get the ol' "The volume on device '[trimmed]' is not part of a multiple family media set. BACKUP WITH FORMAT can be used to form a new media set." error.
I'm assuming this just means that SQL Server can't verify that these log backups are in fact part of a functional "set", even if they aren't part of a traditional backup media set. Is there any way to tell SSMS, "It's okay man, just restore the database from these files, in this order - trust me," or is the only solution restoring every individual log file one at a time? (Which seems to work fine, though is a tremendous pain with any more than a few log backups.) Seems like there ought to be a good one-shot method to restore a bunch of backups to a different server, and I'm just not finding it.
Hi,
I got on my developer computer one instance of msde 2000. I want to test sql server express 2005, can I install it without "scrap" my other instance of 2000?
Strange question maybee, but it's what I wanna do!
Thanks all!
I have a system of SSIS packages in which several packages perform the same lookup on the same table. E.g., i have PackageA, PackageB and PackageC all doing a lookup on TableA. All of these packages are spawned by the same PackageD and run frequently. In some cases, there is an issue with concurrency on these lookups. I get the following exception :
"
The ProcessInput method on component "LKP Lookup SecurityID" (6658) failed with error code 0xC004702C. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
"
The hex code of this exception corresponds to the following description : "DTS_E_BUFFERNOTLOCKED. This buffer is not locked and cannot be manipulated." That's as much as i could find on this.
My suspision is that the SSIS engine somehow figures that the lookup in these distinct packages is the same one and builds a shared version of the lookup table in memory. Then there is some sort of a multi-threading issue in accessing this shared memory which leads to the exception above.
Has anyone experienced this? Can someone shed some light on this?
Thanks a lot
-Alex
Hi guys,
I have experienced problem while trying to use variable with expression based on several other variables in tasks running parallel.
The details are as following:
There is a SSIS package with simple Control flow: one Script Task which actually do nothing and two Execute Process Tasks, they run after Script Task in parallel. Then there are three simple (EvaluateAsExpression = False) string variables ServerName, Folder and JobNumber with values ServerName = €œ\test€?, Folder = €œtest€? and JobNumber = €œ12345€?. And there is one variable FullPath with expression @[User:: ServerName] + "\" + @[User::Folder] + "_" + @[User::JobNumber]. All the variables are of the Package scope. Then in Execute Process Tasks I have similar expressions based on FullPath variable: Execute Process Task 1 has expression @[User::FullPath] + "\date.bat" and Execute Process Task 2 has @[User::FullPath] + "\time.bat" one. As you understand these expressions define what exactly task should execute.
Then I€™m going to execute package from command line so appropriate XML configuration file has been created. The file contains following values for variables described above: ServerName = €œ\LiveServer€?, Folder = €œJob€? and JobNumber = €œ33091€?.
After series of consequent executions I have got following log file:
€¦ Execute Process Task 1€¦ Executing the process €œ\LiveServerJob_33091date.bat€?
€¦ Execute Process Task 2€¦ Executing the process €œ\Test est_12345 ime.bat€?
€¦ Execute Process Task 1€¦ Executing the process €œ\Test est_12345date.bat€?
€¦ Execute Process Task 2€¦ Executing the process €œ\LiveServerJob_33091 ime.bat€?
€¦ Execute Process Task 1€¦ Executing the process €œ\LiveServerJob_33091date.bat€?
€¦ Execute Process Task 2€¦ Executing the process €œ\Test est_12345 ime.bat€?
€¦ Execute Process Task 1€¦ Executing the process €œ\LiveServerJob_33091date.bat€?
€¦ Execute Process Task 2€¦ Executing the process €œ\LiveServerJob_33091 ime.bat€?
€¦
As you can see one of Execute Process Tasks usually receive correct value of the expression (based on values of variables from the configuration file) while another - incorrect one (based on €œdefault€? values of variables set directly in package). Sometimes wrong value appears in Task 1, next time in Task 2. Situations when both expressions in tasks evaluated correctly are very rare.
Then if you add some more Execute Process Tasks with similar expressions in the package (for ex. simply by copying existing tasks) you€™ll get a good chance to catch error like this:
OnError,,,Execute Process Task 1,,,8/17/2007 2:07:12 PM,8/17/2007 2:07:12 PM,-1073450774,0x,Reading the variable "User::FullPath" failed with error code 0xC0047084.
OnError,,,Execute Process Task 1,,,8/17/2007 2:07:12 PM,8/17/2007 2:07:12 PM,-1073647613,0x,The expression "@[User::FullPath] + "\time.bat"" on property "Executable" cannot be evaluated. Modify the expression to be valid.
Seems variable with expression FullPath is locked during evaluation by one of the parallel tasks in such a way that another task can€™t read it value correctly. Can someone help me with the issue? Maybe there are some options I missed which could prevent such behavior of application? Please let me know how I can make the package work correctly.
Am using SSIS to integrate between two database. First one is insert data from SQL to Sybase. its working fine and insert simulatenously. Now need to update table from sybase to SQL with condition(where). How to do this task. Is there any possiblities to execute SSIS without using SQL agent, Â update simultaneously whenever insert new data in both database.
View 8 Replies View RelatedTrying to determine what the minimum permissions i can grant to a user so they can see the change tracking data
View 1 Replies View RelatedWe ran into weird/interesting issue with below details.
Version:Â Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64)Â Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200):
We are using SQLCMD to run DDL script on our product database in below order. That script has below content.
step # 1 - database collation change (case -sensitive) statement as very first statement of the script
step # 2 - Actual DDL SQL statements
step # 3 - database collation change back to original (case insensitive)
When we execute all above 3 steps in single script using SQLCMD on our test_server#1 , it is successful but when same is being implemented on test_ server#2 , it is failing.We ensured that there is no other user accessing the db and setting on both the server are all default/basic. Separating out all 3 steps in 3 different script working fine. This is only problem when we combine them into single script and fire it using SQLCMD. If it is something related to session/transaction then we should hit same issue on our test_server#1 server as well but that is not the case.test_server#1 and test_server#2 has exact same database/data, just two different physical machine & SQL Server instance.
can you change the dbo after you've already made the database?
View 1 Replies View RelatedHi:
Actually i'm working with a pc named "my_pc", later i'll need to change
its name to "my_server". Obviously MsSQLServer is afected due to it depends
in the name of the pc, also the master database has all its configurations
and aditional information related to the name "my_pc".
My question is: How can i do the change in MsSQLServer without
reconstruncting the master database?
Thanks in advance.
Hi
This code is for Access db
strSQL = "SELECT TOP 20 tblThread.Topic_ID, Subject, Username, tblThread.Thread_ID, Message, Message_date "
strSQL = strSQL & "from tblTopic, tblThread, tblAuthor "
strSQL = strSQL & "where tblThread.Topic_ID = tblTopic.Topic_ID "
strSQL = strSQL & "and tblThread.Author_ID = tblAuthor.Author_ID "
strSQL = strSQL & "order by Message_date DESC"
can you rewrite it for SQL Db
with this
strSQL = EXECUTE
thanks
Hi,
Can anyone help me on this problem please?
When i use sql statement to pull out data, one of the fields will pull out data like 200 or 300 or sumthing like that.
But now i need to pull out the data as 2.00 instead of 200.
How do i do that?
Thanx
HI Everyboody,
How can i change SYSTEM ADMINISTORS NAME plz explain me
cureent my system admin name is 'bindu' it will rename 'RENU' How plz explain me
Thx
Meti BEST OF THE BEST
i set the name of my ss to default on install, and now i want to use 'AttachDbFilename' to attach my dbfile in my asp.net app, but i cannot connect to the server. i fond in the adv. options, that the DataSource is set to '.SQLEXPRESS' which is not the name of my SS, but i can't change it, so i want to ask if i can change the name of my SS withou reinstall.
thx for helping!
I have a web app, designed using VWD Express and using SQL 2005 Express. It has a mdf database called "client". It was created using security of windows authentication. I have already changed my instance of sql server express to accept mixed windows and sql authentication.
How do I change my "client" database's permissions to the sql authentication? I need to add a user name and password as a requirement for my web host to be able to attach the mdf to their instance of sql 2005. It has to be the same user and password as I use with my web host's sql server 2005.
Thank you in advance.
Hi All,
Suppose I have created one table say "Customer"
Customer (cust_no, cust_name,cust_address)
I want to change the attribute name "cust_no" to "cust_number".
How to do it using ALTER command.
Pls give me the exact syntax for this.
Regards
Abdul
When I try to execute a query and after 30 seconds the program sends me error :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Exception Detail: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source error:
Line 550 Dim myDataSet as Dataset = New DataSet
Line 551 myDataSet = db.ExecuteDataSet(System.Data.CommanType.Text,NewSql) <== Error line
Line 552 i=myDataSet.Tables(0).Rows.Count
In my connection string I set the parameter "Connection Timeout" = 360 but it not works. ( In debug mode the value for db.GetConnection.ConnectionTimeout is the same(360) like the parameter timeout connection.
After many searchs I found the default value for CommandTimeout is 30 secs. Can I change this value ?
Any suggestion will be welcome.
I'm using FrameWork 1.1.
I was simply trying to create a sql command using ASP 2.0 but the syntax appears to have changed. I was trying to write the following:
SqlCommand cmdUpdateData = new SqlCommand("AddMessage", myConnection);
cmdUpdateData.CommandType = CommandType.StoredProcedure;
But, intellisence will not offer me the second 'CommandType' on the second line?? It works fine using ASP 1.1 but not here on 2.0
Can anyone please help?
hi,
I just imported my access database into sql server 2000 and apparently during this importation the owner was set to my name. This gives my a problem retrieving the data in asp.net though. I found out that the problem (System.Data.SqlClient.SqlException: Invalid object name 'tablename') is situated at this ownership by stripping the query to a bare minimum and trying it on a new table created in sql server with dbo as the owner.
My problem now is that I can't seem to find the way to change the owner to dbo from 'peterj'. Can you help me on this one ??
I have one server out of 6 that lets me logon as SA with the default password
of null.
If I run this command to change the password I get password changed, but it
did not change it, I still can logon as SA with the NULL password.
exec sp_password NULL, abc123, 'sa'