|
You may want to check what you are trying to copy. For instance, if you try to copy a database user/role across - this might be causing it to fail.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey
Thanks for helping.
I don't think that is the problem.
Can you see any other reason ?
I think that the server which I am trying to copy to has an older sqlserver 2005.
How can I do the copying ?
Clint
|
|
|
|
|
hi,
i am having 2 tables (SQL 2000) on 2 different servers (windows 2003 server). now i have to run some inner join on both the tables. i tried by giving
select * from servername1.databasename.dbo.tablename kind of statements in the servername2. but it throws errors. kindly suggest.
thanks
|
|
|
|
|
|
hi all,
I am using MSSQL 2005.
I want to backup my database from the server.
the problem is server is remote.
I can only access the server through "SQL studio management express"
How can i back up the database.
i want the full table with data and SP also
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
As long as you can connect to the database using SSMS you should be able to back it up. The only problem is you won't be able to create the backup on a local drive. You'll have to save the backup to a drive which is on the actual SQL Server instance. Then you'll need to download the backup if you want to have it on your local machine.
To backup a db from SSMS, just right-click the database and select Tasks - Backup... If you create a full backup you'll get all data and tables.
If you're having trouble connecting, creating the backup or downloading a copy of the backup you'll need to contact the administrators in charge of the server where your database is located. They can help you connect and get a backup.
|
|
|
|
|
Hi,
I have to write a common method to bind the sql parameters to the placeholders in the input sql statement.
The sql statement is given as input to the common method and the array of parameters are also given as input..the values should be bind to the placeholders and the resulting sql statement shld be the output...
public string bindSqlParams(string strSql, object[] arrData)
{
}
We can also pass the command object if needed for implementation..please help me with the implementation of this common method..
Thanks in advance...........
|
|
|
|
|
I am creating one stored procedure in which i'm sending group of queries like,
SELECT * FROM TABLEA;AND;SELECT * FROM TABLEB
and i want slipt this input with delimiter ;AND;
means i want seperate the queries.
1. SELECT * FROM TABLEA
2. SELECT * FROM TABLEB
please anybody help me.
Regards,
PVC
|
|
|
|
|
Hi
May be you are trying like this:
Use Northwind
Go
DECLARE @sql nvarchar(2000)
SELECT @sql = 'SELECT * FROM Products;and;SELECT * FROM Region;and;SELECT * FROM Invoices;and;'
SELECT @sql = REPLACE(@sql,';and;',' ')
exec (@sql)
Rate this message. Thank you. Harini
|
|
|
|
|
|
It's good but I need separated queries to be stored in variaable or in temp table as record.
I hope you will help me.
|
|
|
|
|
Hi
Try this:
Use Northwind
Go
DECLARE @sql nvarchar(2000)
SELECT @sql = 'SELECT * FROM Products;and;SELECT * FROM Region;and;SELECT * FROM Invoices;and;'
SELECT @sql = REPLACE(@sql,';and;',';')
DECLARE @theString varchar(4000), @separator char(1)
DECLARE @seppos INT
DECLARE @curval VARCHAR(4000)
SET @theString = @sql
set @separator = ';'
WHILE PATINDEX('%' + @separator + '%' , @theString) <> 0
BEGIN
SELECT @seppos = PATINDEX('%' + @separator + '%' , @theString)
SELECT @curval = LEFT(@theString, @seppos - 1)
--> use this variable for inserting into a table
PRINT 'Select Tables: ' + @curval
SELECT @theString = STUFF(@theString, 1, @seppos, '')
END
Rate this message. Thank you. Harini
|
|
|
|
|
Perfect! this is what I expected.
Thank you very much, Do u have any blog site so that i can reach easily.
Once again thanks.
PVC
|
|
|
|
|
Harini311 wrote: I dont have blog site.
What the... You can blog here[^]
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
how to give DBO permissions to ASPNET_ tables that are created when I used the Login control supplied in visual studio. I created the tables on the SQL Server and pointing my login controls to those tables. But I get an error about DBO rights
please help
Raj D
|
|
|
|
|
Hi,
i have two tables with a 1:n relation. I insert a new row in the first table without knowing the id of it, because of a trigger in the table. Now i want to insert a bunch of rows in the second table, but i need the id of the before inserted row because of the foreign key.
How could i do that?
I use a firebird embedded db with .net + C#
|
|
|
|
|
In MS SQL Server you can call the function SCOPE_IDENTITY() and it will return the identity of the row you just inserted.
Hope that helps.
Ben
|
|
|
|
|
Just set a parameter equal to @@IDENTITY .
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
I found a solution
select gen_id(<generator>, 0) from rdb\$database
@cleako
Could you post an small example? I'm new to programming with databases.
Thank you
|
|
|
|
|
Hello all,
Does anyone know of a good way to script off a SQL server database, including the schema and data? I'd like to be able to do this to make it easy for me to integrate with an existing project without touching the live server. Any ideas?
|
|
|
|
|
SQL Server has built-in facilities for scripting the schema, but does not do data.
We have Red Gate's SQL Compare and SQL Data Compare, the latter tool can do data export in script I believe.
|
|
|
|
|
I have a program (VB.net) that inserts a large amount of records (10,000 records +) into a MySQL database. It takes forever to import these records.
Anyone got some ideas on how to speed this insert up?
|
|
|
|
|
If your current code opens the connection
then does a single insert
Then closes the connection
and then repeats this process 10,000 times.
I would suggest that you open the connection once
do the 10,000 inserts
finally close the connection.
That would be a lot faster.
Next I am not sure if MySQL support stored procedures (I usually use MS Sql Server) If it does a prepared stored procedure will execute faster then in line sql insert.
Next if you have lots of indexes and foreign keys etc. Consider dropping these do all the inserts then add the keys etc after the inserts are done. Of course, this is more work and would probably have to be done off hours, but lots of keys etc can cause the inserts to take longer.
Anyway, a few ideas, hope it helps.
Ben
|
|
|
|
|
Here is my current code and could you modify this to reflect the open connection and close connection like you said?
Dim myConnString As String = My.Settings.ConnectionString
Dim MyConnection As New Odbc.OdbcConnection(myConnString)
MyConnection.Open()
Dim MyCommand As New Odbc.OdbcCommand("INSERT INTO ls_orderitems (OrderDate, OrderCustomer, OrderAcctNum, OrderType, OrderSoNum, OrderItemPartNum, OrderItemPartDesc, OrderItemQty, OrderItemQtyRec, OrderItemQtyDtRec, OrderItemBO, OrderItemBODt,OrderItemCanceled, OrderItemCanceledDt, OrderItemNotes, OrderItemPONum, OrderItemRetailPrice, OrderItemSalePrice, Status, InsertDate) VALUES('" & OrderDate & "','" & OrderCustomer & "','" & OrderAcctNum & "','" & OrderType & "','" & OrderSoNum & "','" & OrderItemPartNum & "','" & OrderItemPartDesc & "','" & OrderItemQty & "','" & OrderItemQtyRec & "','" & OrderItemQtyDtRec & "','" & OrderItemBO & "','" & OrderItemBODt & "','" & OrderItemCanceled & "','" & OrderItemCanceledDt & "','" & OrderItemNotes & "','" & OrderItemPONum & "','" & OrderItemRetailPrice & "','" & OrderItemSalePrice & "','" & Status & "','" & InsertDate & "')")
MyCommand.Connection = MyConnection
MyCommand.ExecuteNonQuery()
MyConnection.Close()
|
|
|
|
|
I am guessing that you have a loop outside of the code you posted, so I would do something like this:
Dim myConnString As String = My.Settings.ConnectionString
Dim MyConnection As New Odbc.OdbcConnection(myConnString)
Try
MyConnection.Open()
'your loop code here
Dim MyCommand As New Odbc.OdbcCommand("INSERT INTO ls_orderitems (OrderDate, OrderCustomer, OrderAcctNum, OrderType, OrderSoNum, OrderItemPartNum, OrderItemPartDesc, OrderItemQty, OrderItemQtyRec, OrderItemQtyDtRec, OrderItemBO, OrderItemBODt,OrderItemCanceled, OrderItemCanceledDt, OrderItemNotes, OrderItemPONum, OrderItemRetailPrice, OrderItemSalePrice, Status, InsertDate) VALUES('" & OrderDate & "','" & OrderCustomer & "','" & OrderAcctNum & "','" & OrderType & "','" & OrderSoNum & "','" & OrderItemPartNum & "','" & OrderItemPartDesc & "','" & OrderItemQty & "','" & OrderItemQtyRec & "','" & OrderItemQtyDtRec & "','" & OrderItemBO & "','" & OrderItemBODt & "','" & OrderItemCanceled & "','" & OrderItemCanceledDt & "','" & OrderItemNotes & "','" & OrderItemPONum & "','" & OrderItemRetailPrice & "','" & OrderItemSalePrice & "','" & Status & "','" & InsertDate & "')")
MyCommand.Connection = MyConnection
MyCommand.ExecuteNonQuery()
'bottom of your loop code
Finally
MyConnection.Close()
End Try
That way you only open the connection once then do all your inserts, finally close the connection.
Hope that helps.
Ben
|
|
|
|
|