Showing posts with label 2000i. Show all posts
Showing posts with label 2000i. Show all posts

Wednesday, March 28, 2012

How to Transfer View only?

Hi,
I'm using MS SQL Server 2000
I have 2 Northwind databases on the same server (local)
NwindA and NwindB
In NwindA I have vNewView
How do I transfer this vNewView from A to B (just the view not the data)
( I have hundreds of view that I need to transfer)
Thanks,
Oded DrorOded,shalom
I'd prefer doing such tasks with SQL DMO objects. Also , you can generate
script of all objects by using EM (right click on the database then
'Generate SQL Script')
Look at this example scripting all views into the file.
Sub ScriptDB(strLogin As String, strPwd As String, _
strDataBase As String, StrFilePath As String)
Dim sql As Object
Dim db As Object
Dim objTrigger As Object
Dim intOptions As Long
Dim genObj
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")
Const sDrops As Integer = 1
Const sIncludeHeaders As Long = 131072
Const sDefault As Integer = 4
Const sAppendToFile As Integer = 256
Const sBindings As Integer = 128
' Set scripting options. Because you need to specify multiple behaviors
' for the ScriptType argument, you use "Or" to combine these.
intOptions = sDrops Or sIncludeHeaders Or _
sDefault Or sAppendToFile Or sBindings
' Connect to local server
sql.Connect "(local)", strLogin, strPwd
Set db = sql.Databases(strDataBase, "dbo")
' Script Views, ignoring system views and informational schemas
For Each genObj In db.Views
If genObj.SystemObject = False Then
genObj.Script intOptions, StrFilePath
End If
Next
MsgBox "Finished generating SQL scripts."
End Sub
Save the module as MyModule.
To call the procedure, open the Immediate window, type the following line,
and then press ENTER:Call
ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
Call ScriptDB("UserName","Password","DatabaseName","C:\MyResults.SQL")
"Oded Dror" <odeddror@.cox.net> wrote in message
news:O6lABUGAGHA.208@.tk2msftngp13.phx.gbl...
> Hi,
> I'm using MS SQL Server 2000
> I have 2 Northwind databases on the same server (local)
> NwindA and NwindB
> In NwindA I have vNewView
> How do I transfer this vNewView from A to B (just the view not the data)
> ( I have hundreds of view that I need to transfer)
> Thanks,
> Oded Dror
>|||In EM, right-click your source db and choose All Tasks | Export Data. In th
e
wizard, fill out the connection and database names.
Choose "Copy objects and data between..."
Deselect "Include all dependent objects"
Deselect "Copy Data"
Deselect "Copy all objects."
Click "Select Objects".
Find and select the views you want.
Deselect "Use default options"
Click "Options" and verify the settings such as copying the database users,
etc.
Finish the wizard with run immediate or schedule later.
Hope that helps,
Joe
"Oded Dror" wrote:

> Hi,
> I'm using MS SQL Server 2000
> I have 2 Northwind databases on the same server (local)
> NwindA and NwindB
> In NwindA I have vNewView
> How do I transfer this vNewView from A to B (just the view not the data)
> ( I have hundreds of view that I need to transfer)
> Thanks,
> Oded Dror
>
>sql

Monday, March 19, 2012

How to take back up using query analyzer

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
Jyothi
Answered in microsoft.public.sqlserver.programming
Please do not multi-post.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:%23uGZUP%23$FHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>

How to take back up using query analyzer

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
JyothiAnswered in microsoft.public.sqlserver.programming
Please do not multi-post.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:%23uGZUP%23$FHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>

how to take back up

Hi
Can anybody tell me how to take database back up using query analyzer in sql
server 2000?
i dont want in enterprise manager i wnat to know how to do it with query
analyzer.
can you tell me y i'm getting this error when i'm trying to open enterprise
manager
"SQLDMO has not been registered, please re-run SQL SERVER setup and contact
your system administrator"
i can re-run setup but i need to take back up first and it is not giving any
error when opening sql query analyzer.
so can any one tell me
Thanx in advance
JyothiBACKUP DATABASE <dbname>
TO DISK = "d:\temp\backup.bak"
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"yoshitha" <gudivada_kmm@.yahoo.co.in> wrote in message
news:eA81FP%23$FHA.216@.TK2MSFTNGP15.phx.gbl...
> Hi
> Can anybody tell me how to take database back up using query analyzer in
> sql server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open
> enterprise manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and
> contact your system administrator"
> i can re-run setup but i need to take back up first and it is not giving
> any error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>|||Hi
Check out the description of the backup command in Books online or at
http://msdn.microsoft.com/library/d...asp?frame=true
John
"yoshitha" wrote:

> Hi
> Can anybody tell me how to take database back up using query analyzer in s
ql
> server 2000?
> i dont want in enterprise manager i wnat to know how to do it with query
> analyzer.
> can you tell me y i'm getting this error when i'm trying to open enterpris
e
> manager
> "SQLDMO has not been registered, please re-run SQL SERVER setup and contac
t
> your system administrator"
> i can re-run setup but i need to take back up first and it is not giving a
ny
> error when opening sql query analyzer.
> so can any one tell me
> Thanx in advance
> Jyothi
>
>

Monday, March 12, 2012

How to synchronize 2 tables on different sql servers

Hi, anybody can help me.

How can i synchronize 2 tables on 2 different sql servers 2000

i mean TABLE1(col1, col2, col3, col4) and
TABLE1(col1, col2, col3, col4, col5, col6)

the first 3 colums are the same in rwo tables.

Thanks

--
Message posted via http://www.sqlmonster.comalex via SQLMonster.com (forum@.nospam.SQLMonster.com) writes:
> Hi, anybody can help me.
> How can i synchronize 2 tables on 2 different sql servers 2000
> i mean TABLE1(col1, col2, col3, col4) and
> TABLE1(col1, col2, col3, col4, col5, col6)
>
> the first 3 colums are the same in rwo tables.

Could you be more specific on what you mean. Do you want to synchronize
data or metadata? And what should the synchronization result in?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks for replay, i want to synchronize
data between two tables? i don't know how to acomplish that.
Maybe u can suggest me some stuff to read about topic?

P.S. i had read your articles about Error Handling very helpful.

thanks

--
Message posted via http://www.sqlmonster.com|||alex via SQLMonster.com (forum@.SQLMonster.com) writes:
> Thanks for replay, i want to synchronize
> data between two tables? i don't know how to acomplish that.
> Maybe u can suggest me some stuff to read about topic?

Well, if you know you are in A and want to go B, I might be able to
help you, if you tell me where A and B are.

But if you don't know where you want to go, then I cannot help you with
that part. "Synchronize the tables" could mean a lot of things, and I'm
not active in this newsgroup to play guessing games.

Please give an example of what you have, and where you want to arrive.
Then we might be able to suggest something.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Ok, sorry about my explanation .

I have two sql servers that runs on different machines

each of sql servers have database (there is not same database) however
there is table (suppose myTable) that is same to two databases and i need
to synchronize between them in this case e.g.

sqlServer1 myTable1
sqlServer2 myTable2

in case some data is changed in [sqlServer1 myTable1] i need that
[sqlServer2 myTable2] will changed too according to [sqlServer1 myTable1]
and not vice versa i.e i need that [sqlServer2 myTable2] will ALLWAYS have
data like [sqlServer1 myTable1]

--
Message posted via http://www.sqlmonster.com|||alex via SQLMonster.com (forum@.SQLMonster.com) writes:
> Ok, sorry about my explanation .
> I have two sql servers that runs on different machines
> each of sql servers have database (there is not same database) however
> there is table (suppose myTable) that is same to two databases and i need
> to synchronize between them in this case e.g.
>
> sqlServer1 myTable1
> sqlServer2 myTable2
> in case some data is changed in [sqlServer1 myTable1] i need that
> [sqlServer2 myTable2] will changed too according to [sqlServer1 myTable1]
> and not vice versa i.e i need that [sqlServer2 myTable2] will ALLWAYS have
> data like [sqlServer1 myTable1]

One method is to set up replication, although a replication topology
for one single table is probably an overkill. Also, that would require
the tables to have the same metadata, and your initial post indicated
that they have different columns.

Another method is to set up SqlServer2 as a linked server on
SqlServer1, and then have a trigger that replicates the data to
the table on SqlServer2. If the network is not always up, or if it is
slow, this can cause updates on Server1 to be slow.

Yet another possibility is to set up Server1 as a linked server on Server2,
and regularly poll, for instance from SQL Server Agent. If the table
is moderate in size, it might be feasible to simply truncate the
table, and then load the data over. Of course, this won't do, if the
table is has many rows.

Yet a possibiliy is a combination of the last two: you have a trigger
which writes to a table local to Server1, and then Server2 pulls the
chagens from this table, and then deletes the rows in the table. Here
some care needs to be taken so that you don't miss any updates, but
also you don't lock the source tables for updates while fetching.

Which of these to choose depends on your exact requirements, which
privileges you can run this under, which possibilities you have to
set up linked servers and create triggers etc.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||thanks, this more that i expect.

--
Message posted via http://www.sqlmonster.com