OPENQUERY will solve your problem. Examples:
--This will fail:
select * from server1.bb01_db.dbo.bb01 (nolock)
where process_dt = '2002-12-02' and mid = '03301001' and
tran_dt = '2002-12-02'
--This will work if you have your linked servers set up --
correctly:
select * from openquery(server1, 'select * from
bb01_db.dbo.bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001''
and tran_dt = ''2002-12-02''')
Ths will also work
exec server1.bb01_db.dbo.sp_executesql N'select * from bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001'' and
tran_dt =''2002-12-02'''
If those are datetimes then you should use yyyymmdd especially with remote
server calls just in case the dateformats are different.
"CurtM" wrote:
> OPENQUERY will solve your problem. Examples:
> --This will fail:
> select * from server1.bb01_db.dbo.bb01 (nolock)
> where process_dt = '2002-12-02' and mid = '03301001' and
> tran_dt = '2002-12-02'
> --This will work if you have your linked servers set up --
> correctly:
> select * from openquery(server1, 'select * from
> bb01_db.dbo.bb01 (nolock)
> where process_dt = ''2002-12-02'' and mid = ''03301001''
> and tran_dt = ''2002-12-02''')
>
Showing posts with label server1. Show all posts
Showing posts with label server1. Show all posts
Wednesday, March 28, 2012
OpenQuery
Labels:
2002-12-02,
bb01,
bb01_db,
database,
dbo,
examples-this,
failselect,
microsoft,
mysql,
nolock,
openquery,
oracle,
process_dt,
server,
server1,
solve,
sql
OpenQuery
OPENQUERY will solve your problem. Examples:
--This will fail:
select * from server1.bb01_db.dbo.bb01 (nolock)
where process_dt = '2002-12-02' and mid = '03301001' and
tran_dt = '2002-12-02'
--This will work if you have your linked servers set up --
correctly:
select * from openquery(server1, 'select * from
bb01_db.dbo.bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001''
and tran_dt = ''2002-12-02''')Ths will also work
exec server1.bb01_db.dbo.sp_executesql N'select * from bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001'' and
tran_dt =''2002-12-02'''
If those are datetimes then you should use yyyymmdd especially with remote
server calls just in case the dateformats are different.
"CurtM" wrote:
> OPENQUERY will solve your problem. Examples:
> --This will fail:
> select * from server1.bb01_db.dbo.bb01 (nolock)
> where process_dt = '2002-12-02' and mid = '03301001' and
> tran_dt = '2002-12-02'
> --This will work if you have your linked servers set up --
> correctly:
> select * from openquery(server1, 'select * from
> bb01_db.dbo.bb01 (nolock)
> where process_dt = ''2002-12-02'' and mid = ''03301001''
> and tran_dt = ''2002-12-02''')
>sql
--This will fail:
select * from server1.bb01_db.dbo.bb01 (nolock)
where process_dt = '2002-12-02' and mid = '03301001' and
tran_dt = '2002-12-02'
--This will work if you have your linked servers set up --
correctly:
select * from openquery(server1, 'select * from
bb01_db.dbo.bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001''
and tran_dt = ''2002-12-02''')Ths will also work
exec server1.bb01_db.dbo.sp_executesql N'select * from bb01 (nolock)
where process_dt = ''2002-12-02'' and mid = ''03301001'' and
tran_dt =''2002-12-02'''
If those are datetimes then you should use yyyymmdd especially with remote
server calls just in case the dateformats are different.
"CurtM" wrote:
> OPENQUERY will solve your problem. Examples:
> --This will fail:
> select * from server1.bb01_db.dbo.bb01 (nolock)
> where process_dt = '2002-12-02' and mid = '03301001' and
> tran_dt = '2002-12-02'
> --This will work if you have your linked servers set up --
> correctly:
> select * from openquery(server1, 'select * from
> bb01_db.dbo.bb01 (nolock)
> where process_dt = ''2002-12-02'' and mid = ''03301001''
> and tran_dt = ''2002-12-02''')
>sql
Monday, February 20, 2012
Online Restore.
Hi,
Can i take backup(not full db, only one filegroup) of a database in
Server1 and restore it on a same database in another server2 using
Online Restore commands. Note:both database has same schema and data.
Addtional data in few tables in server1 needs to be copied to server2
and those tables are in separate filegroup.
Could you please send me the sequence of steps to do the online
restore?
Thanks in Advance
Regards
MaheshOnline restore as you said was introduced in sql server 2005 (enterprise
edition ) if i remember well
Why do you need an online restore? Some users are using the database on
server2?
Are you using sql server 2005?
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160544431.729794.226080@.m7g2000cwm.googlegroups.com...
> Hi,
> Can i take backup(not full db, only one filegroup) of a database in
> Server1 and restore it on a same database in another server2 using
> Online Restore commands. Note:both database has same schema and data.
> Addtional data in few tables in server1 needs to be copied to server2
> and those tables are in separate filegroup.
> Could you please send me the sequence of steps to do the online
> restore?
> Thanks in Advance
> Regards
> Mahesh
>|||Yes. we are using sql2005(enterprise Edition). we tried online restore
but the status of the database changed to Restoring... so please send
me the steps to do online restore.
Thanks
Regards
Mahesh
Uri Dimant wrote:
> Online restore as you said was introduced in sql server 2005 (enterprise
> edition ) if i remember well
> Why do you need an online restore? Some users are using the database on
> server2?
> Are you using sql server 2005?
>|||Hi
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160564344.563238.11560@.i42g2000cwa.googlegroups.com...
> Yes. we are using sql2005(enterprise Edition). we tried online restore
> but the status of the database changed to Restoring... so please send
> me the steps to do online restore.
> Thanks
> Regards
> Mahesh
> Uri Dimant wrote:
>> Online restore as you said was introduced in sql server 2005 (enterprise
>> edition ) if i remember well
>> Why do you need an online restore? Some users are using the database on
>> server2?
>> Are you using sql server 2005?
>>
>|||Hi,
i am not able to access the below page. i am getting 'the page cannot
be displayed' error. could you please send me the URL or Please send me
content as doc to my id.
My ID: nrkmahesh@.gmail.com
Thanks a lot
Regards
Mahesh
Uri Dimant wrote:
> Hi
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
>|||The URL Uri posted is a SQL Sever 2005 Books Online reference. Open the SQL
Sever 2005 Books Online (a.k.a. help), view a topic and paste the URL into
the URL address bar.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160566954.263572.187590@.e3g2000cwe.googlegroups.com...
> Hi,
> i am not able to access the below page. i am getting 'the page cannot
> be displayed' error. could you please send me the URL or Please send me
> content as doc to my id.
> My ID: nrkmahesh@.gmail.com
> Thanks a lot
> Regards
> Mahesh
> Uri Dimant wrote:
>> Hi
>> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
>>
>
Can i take backup(not full db, only one filegroup) of a database in
Server1 and restore it on a same database in another server2 using
Online Restore commands. Note:both database has same schema and data.
Addtional data in few tables in server1 needs to be copied to server2
and those tables are in separate filegroup.
Could you please send me the sequence of steps to do the online
restore?
Thanks in Advance
Regards
MaheshOnline restore as you said was introduced in sql server 2005 (enterprise
edition ) if i remember well
Why do you need an online restore? Some users are using the database on
server2?
Are you using sql server 2005?
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160544431.729794.226080@.m7g2000cwm.googlegroups.com...
> Hi,
> Can i take backup(not full db, only one filegroup) of a database in
> Server1 and restore it on a same database in another server2 using
> Online Restore commands. Note:both database has same schema and data.
> Addtional data in few tables in server1 needs to be copied to server2
> and those tables are in separate filegroup.
> Could you please send me the sequence of steps to do the online
> restore?
> Thanks in Advance
> Regards
> Mahesh
>|||Yes. we are using sql2005(enterprise Edition). we tried online restore
but the status of the database changed to Restoring... so please send
me the steps to do online restore.
Thanks
Regards
Mahesh
Uri Dimant wrote:
> Online restore as you said was introduced in sql server 2005 (enterprise
> edition ) if i remember well
> Why do you need an online restore? Some users are using the database on
> server2?
> Are you using sql server 2005?
>|||Hi
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160564344.563238.11560@.i42g2000cwa.googlegroups.com...
> Yes. we are using sql2005(enterprise Edition). we tried online restore
> but the status of the database changed to Restoring... so please send
> me the steps to do online restore.
> Thanks
> Regards
> Mahesh
> Uri Dimant wrote:
>> Online restore as you said was introduced in sql server 2005 (enterprise
>> edition ) if i remember well
>> Why do you need an online restore? Some users are using the database on
>> server2?
>> Are you using sql server 2005?
>>
>|||Hi,
i am not able to access the below page. i am getting 'the page cannot
be displayed' error. could you please send me the URL or Please send me
content as doc to my id.
My ID: nrkmahesh@.gmail.com
Thanks a lot
Regards
Mahesh
Uri Dimant wrote:
> Hi
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
>|||The URL Uri posted is a SQL Sever 2005 Books Online reference. Open the SQL
Sever 2005 Books Online (a.k.a. help), view a topic and paste the URL into
the URL address bar.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Mahesh" <nrkmahesh@.gmail.com> wrote in message
news:1160566954.263572.187590@.e3g2000cwe.googlegroups.com...
> Hi,
> i am not able to access the below page. i am getting 'the page cannot
> be displayed' error. could you please send me the URL or Please send me
> content as doc to my id.
> My ID: nrkmahesh@.gmail.com
> Thanks a lot
> Regards
> Mahesh
> Uri Dimant wrote:
>> Hi
>> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/7982a687-980a-4eb8-8e9f-6894148e7d8c.htm
>>
>
Subscribe to:
Posts (Atom)