|
Suppose in my SQL2005 database accounting is used in LAN, their copy two files: data1.mdf and data1_log.LDF another folder and renamed data2_log.LDF data2.mdf and, then, di transfer these 2 files into the same directory that contains the original accounting database when attach data2.mdf file into SQL2005 error: Can not attach a database with the same name as an existing database there. While I have renamed then why not attach files? want to attach the data file do?
|
|
|
|
|
let me guess, you rename it from windows explorer, am i right?
it's okay, before you're going to press ok (proceed attach), at top of the form, there's "Attach As" column, change your database name below, good luck!
|
|
|
|
|
|
Seriously you are going about this completely the wrong way, you are treating SQL Server like a single user database IT IS NOT. To transfer databases you need to use the database tools NOT the windows explorer copy/paste.
Stop, close down all your DB stuff and do some learning about SQL Server first, not by trying to use what little you know but by getting a book and studying it or work through some examples, try SQLServerCentral.com they are specialists in this area.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
assuming you have 2 SQL2005 database: data1 and data2, I Copy stored procedures from data2 to data1 why not? I want to copy stored procedures through other databases you do?
|
|
|
|
|
I assume each database has the same table structure so the stored procedure will actually work!
You need to create a script of the stored proc and run the script in each database. Using SSMS right click on the procedure and script as create to a new query window. Then change databases and run the script.
Lean how to use the Management Studio!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I do not want to create new, I want to Copy stored procedures to another database and to quickly change their
|
|
|
|
|
Which just reinforces my comment on the above thread, you have no idea what you are doing, get a book and do some reading on how databases work.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I have 2 SQL servers (MS SQL and ORACLE).
I an running an update openquery (from MS SQL) in order to update a table from Oracle.
My select from openquery is not based on a simple select from one table; it is using few inner joins among tables from both servers.
When I am runnig the update I receive the following error:
<b>ROW-00009: Cannot update row in a read-only rowset ]</b>
As far as i read on the net, I saw that there is not possible because of too complex code.
Does anyone have any idea if there exists any workaround for this?
Thanks a lot.
-- modified 6-Jul-12 3:40am.
|
|
|
|
|
mikcutu wrote: My select from openquery is not based on a simple select from one table; it is using few inner joins among tables from both servers.
How about doing those inner joins, and put the result in a temporary table? That way you'd have a "simple" table to update.
That way you'd also see whether the error is in the query itself, or during the update.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hello Eddy,
Thanks for reply me. In the end, my update should be in a final table and this means to have also a join between the final table and the temporary one but this makes me thinking to try using a view for entire join selection and use it into the openquery.
I will try this and let you know.
Cheers,
Mikcutu.
|
|
|
|
|
hi
i have a program with c# and sql server 2005.
i should install it on some stand_alone computers.
For reporting i need to integrate these DB's data into one DB. I need a simple solution for a simple user to do that. could you give me a solution???
|
|
|
|
|
hs_rostami wrote: could you give me a solution
No
There is no simple solution, either designed you application incorrectly or are in way over your head.
You need to look into Replication or data wharehousing (although I doubt this applies) and your data need to be structured to support integrating it into 1 DB.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hs_rostami wrote: For reporting i need to integrate these DB's data into one DB. I need a simple solution for a simple user to do that.
Simple users aren't allowed near the database.
Your easiest way out is to include an extra field in each table, called "DatabaseName". Next, change every sql statement to only update the data where that field matches your current client. It's not optimal, but it would allow for multiple databases to be stored in a single database-file.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I have the same database on different computers, with different raw data of any department, but structures and tables are the same. i have no network, i wanna bring these data toghether for reporting. for example I have these DB's:
database 1 : person1 , persson2
database 2 : person3 , persson4
database 3 : person5 , persson6
and I need this for reporting:
General Database: person1 , persson2, person3 , persson4, person5 , persson6
|
|
|
|
|
Same applies; if you had a field called "database", you could drop them all in the same structure.
Small example;
EmplyeeTable
Id Name OtherStuff
1 John Bla
becomes;
EmplyeeTable
Id Name OtherStuff Database
1 John Bla Customer1
That way you could select everything from that customer, even if there's more than one customers data.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
Can the following be used in a stored procedure?
convert(float, (columnname))like @x
I've tried it. It works.
Wanted to know if it's a good way of programming?
Cheers
Berba
|
|
|
|
|
As you will be converting the value of each item in columnname to float , this is a more expensive operation than converting the value in @x into the appropriate type.
|
|
|
|
|
And then they're converted to string, which is worse.
|
|
|
|
|
berba wrote: if it's a good
Most likely not; all those conversions will kill you. What are you trying to do? Perhaps you want BETWEEN ?
As mentioned, converting the parameter value (once) is much better* than converting all the values in the column.
* Anecdote: I once inherited maintenance of a batch program that took forty minutes to run; after fixing the conversions it took only ten minutes.
|
|
|
|
|
Hi,
Can any one tell me how to run a job in oracle which take all the data from one table(for ex: name,address,lastlogintime,etc) and generate output in excel format and save in one common folder everyday.
If you have a sample code, could you share it please, it would be helpfull in understanding the concept better.
|
|
|
|
|
What part of the concept is troubling you?
Write a console-app that executes a query on your Oracle-database. There's quite some examples on the internet that show you how to achieve that part. Next, iterate through the results, and write them out to a file. Excel will accept almost everything, from CSV to XML. We got some nice articles on CP that explain how to write to Excel in various ways.
Not much to concept there. If you have the first part of the assignment, we'll talk about writing those results to Excel.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Basic Steps
1. Create/find scheduler
2. Create SQL that gets the data
3. Create code the outputs the data
4. Put 1-3 together.
Steps 1-3 are independent. They do NOT have anything to do with each other.
Step 3 is the only one specific to Excel.
|
|
|
|
|
Hi I have a problem writing an query with select parameter as input paramter in the stored procedure.
CREATE PROCEDURE [dbo].[SelectItemList]
@ColName string,
@ID int
AS
BEGIN TRANSACTION
SELECT @ColName FROM ItemList where ID = @ID
COMMIT TRANSACTION
Is it possible something like this with select paramter also included in input paramter to the stored procedure?
Thanks in advance,
Dhyanga
|
|
|
|
|
Why don't you try along these lines:
CREATE PROCEDURE [dbo].[SelectItemList]
@ColName string,
@FieldName string,
@FieldValue int
AS
BEGIN TRANSACTION
SELECT @ColName FROM ItemList where @FieldName = @FieldValue
COMMIT TRANSACTION
[EDIT: this doesn't solve it. The message by Michael Potter holds the answer.[/EDIT]
modified 29-Jun-12 9:41am.
|
|
|
|