Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Sunday, March 25, 2012

ActiveX Script Task - SSIS

Within a SQL 2000 DTS Package I have an ActiveX Script that would go within my transform tasks and update the queries by concatenating a "Where" clause with a date from a database table. This way I could keep track of when the last time I updated the table so that I could only bring down the rows since the last run. How can this be done within SSIS? I've been looking and I'm getting confused. Any help would be greatly appreciated.

The most analogous thing to an ActiveX Script in SSIS is the script component but that isn't what you want to use here. Instead, set the SQL statement that pulls data from your source dynamically like so: http://blogs.conchango.com/jamiethomson/archive/2005/12/09/2480.aspx

-Jamie

|||

Jamie,

Thank you for your response. We went ahead and used a data flow with a RecordSet Destination. Then we used a "ForEach" loop to cycle through the RecordSet and run our query based on each value and then stored the data in a raw table.

Thanks again for all your help on this issue and others.

Jerry

sql

Thursday, March 22, 2012

Active/Active configuration queries

Hi,
I completely understand that SQL-Clustering is failover
technology and not a load balancing technology.
1. What I'm wondering is when you go for Active/Active
mode, then whether both the nodes communicates with the
single instance of shared device or only 1 node
communicates with it?
2. If only 1 node communicates then what is the advantage
of Active/Active configuration over Active/Passive
configuration?
3. Also I guess Active/Active configuration requires 2
licenses of SQL-2000. Is that true?
4. I know that we can run 16 instances of SQL-2000 on a
cluster. Now, I understand that - logically, each instance
data would be different than other thats why it is a
seperate instance. So how does the client application
knows which instance data to use? How does the application
takes care of providing latest data always?
Thanks in advance
Pankaj A. Chitriv
Hi Pankaj,
I will try to answer your questions.
1. What I'm wondering is when you go for Active/Active
mode, then whether both the nodes communicates with the
single instance of shared device or only 1 node
communicates with it?
Answer - By shared device, I assume you mean shared drive. Each instance
works with it's own shared disk(s), but never will they intermix.
For example:
VirtualServer1\Instance1 has disks R:, S:, and T: in it's group.
VirtualServer2\Instance2 has disks X:, Y: and Z: in it's group.
The data in X, Y, and Z is complete separate from R, S, T and would never
ever be accessible to VirtualServer\Instance1 unless you uninstalled
Instance2.
This is true even if both instances are running on the same node (physical
machine). Instances should be thought of as COMPLETELY independent from
each other, as if they were running on completely separate machines.
2. If only 1 node communicates then what is the advantage
of Active/Active configuration over Active/Passive
configuration?
Answer - Advantage of Active/Active - You add another SQL server to your
environment. The other node isn't sitting there idly waiting for a
failover that might or might not happen. It's actually being used.
3. Also I guess Active/Active configuration requires 2
licenses of SQL-2000. Is that true?
Answer - True.
4. I know that we can run 16 instances of SQL-2000 on a
cluster. Now, I understand that - logically, each instance
data would be different than other thats why it is a
seperate instance. So how does the client application
knows which instance data to use? How does the application
takes care of providing latest data always?
Answer - You configure your client application to talk to the instance of
SQL it should be using.
For example:
1st Physical Machine Name: NodeA
2nd Physical Machine Name: NodeB
VirtualServer1\Instance1 uses Drive T: and holds accounting data
VirtualServer2\Instance2 uses Drive U: and holds marketing data
Users in the marketing department would connect to VirtualServer2\Instance2
Users in the accounting department would connect to VirtualServer1\Instance1
You would specify the SQL Instance in a UDL File, connection string, DSN,
or however your application requires you to specify the servername.
For more information and a great installation checklist, check out the
following:
SQL Server 2000 Failover Clustering
http://www.microsoft.com/technet/pro.../failclus.mspx

Active/Active configuration queries

Hi,
I completely understand that SQL-Clustering is failover technology and not a
load
balancing technology.
1. What I'm wondering is when you go for Active/Active mode, then whether
both the nodes communicates with the single instance of shared device or only
1 node
communicates with it?
2. If only 1 node communicates then what is the advantage of Active/Active
configuration over Active/Passive configuration?
3. Also I guess Active/Active configuration requires 2 licenses of SQL-2000.
Is that
true?
4. I know that we can run 16 instances of SQL-2000 on a cluster. Now, I
understand that - logically, each instance data would be different than other
thats why it is a seperate instance. So how does the client application knows
which instance data to use? How does the application takes care of providing
latest data always?
Thanks in advance
Pankaj A. Chitriv
Answers inline
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
news:D7F79263-D4D3-4C74-9CBF-E88D95C3E7C7@.microsoft.com...
> Hi,
> I completely understand that SQL-Clustering is failover technology and not
a
> load
> balancing technology.
> 1. What I'm wondering is when you go for Active/Active mode, then whether
> both the nodes communicates with the single instance of shared device or
only
> 1 node
> communicates with it?
The cluster service arbitrates ownership. All host nodes are pysically
connected to the shared storage system, but only one node actually owns and
modifies the on-disk information
> 2. If only 1 node communicates then what is the advantage of Active/Active
> configuration over Active/Passive configuration?
>
Active-Active is really multi-instance. You load a second sql server
instance with a different set of physical shared disks.

> 3. Also I guess Active/Active configuration requires 2 licenses of
SQL-2000.
> Is that
> true?
Depends on your licensing model. Read the licensing page to be sure.
> 4. I know that we can run 16 instances of SQL-2000 on a cluster. Now, I
> understand that - logically, each instance data would be different than
other
> thats why it is a seperate instance. So how does the client application
knows
> which instance data to use? How does the application takes care of
providing
> latest data always?
Each instance has its own Network name and IP address. To the client, they
all look like different SQL servers.

> Thanks in advance
> Pankaj A. Chitriv
>
|||Thanks Geoff again (I remember you)
1. What I understand by "multi-instance" is the different Alias created
using the "Client Network Utility". Is that true? or Instance means- I'll
have to install SQL server and give different service name during
installation?
2. Although each instance has its own Network name and IP address, all of
them points to the same sql database on the shared device. Correct?
Regards,
Pankaj
"Geoff N. Hiten" wrote:

> Answers inline
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
> news:D7F79263-D4D3-4C74-9CBF-E88D95C3E7C7@.microsoft.com...
> a
> only
> The cluster service arbitrates ownership. All host nodes are pysically
> connected to the shared storage system, but only one node actually owns and
> modifies the on-disk information
> Active-Active is really multi-instance. You load a second sql server
> instance with a different set of physical shared disks.
> SQL-2000.
> Depends on your licensing model. Read the licensing page to be sure.
> other
> knows
> providing
> Each instance has its own Network name and IP address. To the client, they
> all look like different SQL servers.
>
>
>
|||More Comments Inline.
BTW, this is my last answer for about a week. Vacation time.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
news:E0413295-17C7-4A39-A656-753AB9612811@.microsoft.com...
> Thanks Geoff again (I remember you)
> 1. What I understand by "multi-instance" is the different Alias created
> using the "Client Network Utility". Is that true? or Instance means- I'll
> have to install SQL server and give different service name during
> installation?
>
You must supply a unique Network name and IP address for each instance. You
can use the Server Network Utility to assign non-standard port addresses if
you wish.

> 2. Although each instance has its own Network name and IP address, all of
> them points to the same sql database on the shared device. Correct?
>
Wrong. No. Not that. Nada. Nope.
The physical device is "shared" in that it is physically accessable from all
host nodes. It is "shared nothing" in that only a single host actually
controls each LUN at any time. SAN storage devices present logical slices
of their storage systems (LUNS) to their connected hosts. The cluster
service arbitrates ownership so a host owns the storage resources associated
with a specific instance currently running on that host. There is NO
sharing of data storage between instances.
[vbcol=seagreen]
> Regards,
> Pankaj
>
> "Geoff N. Hiten" wrote:
not[vbcol=seagreen]
whether[vbcol=seagreen]
or[vbcol=seagreen]
and[vbcol=seagreen]
Active/Active[vbcol=seagreen]
I[vbcol=seagreen]
than[vbcol=seagreen]
application[vbcol=seagreen]
they[vbcol=seagreen]

Monday, March 19, 2012

Active Directory Queries

Hi,
I'm interested in querying my domain's Active Directory database from SQL
Server 2000. In particular, I would like to be able to take a network user
name and determine its membership in network groups so I can list all the
network logins that user has to a SQL server instance. I would like to do
this from T-SQL, if possible.
Thank you,
Daniel Jameson
SQL Server DBA
Children's Oncology Group
www.childrensoncologygroup.orgDaniel,
there's not a huge amount of details about ADSI queries, but these links
should help you set it up:
http://msdn.microsoft.com/library/d...
uted_query.asp
http://msdn.microsoft.com/library/d...r />
_94fn.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com|||Paul,
Cool, that looks like a good start. Now I just need to learn those LDAP
queries.
Thank you,
Daniel Jameson
SQL Server DBA
Children's Oncology Group
www.childrensoncologygroup.org
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:uIGwD$6xGHA.2396@.TK2MSFTNGP03.phx.gbl...
> Daniel,
> there's not a huge amount of details about ADSI queries, but these links
> should help you set it up:
> http://msdn.microsoft.com/library/d...buted_query.asp
> http://msdn.microsoft.com/library/d.../>
12_94fn.asp
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
>

Active Directory Queries

Hi,
I'm interested in querying my domain's Active Directory database from SQL
Server 2000. In particular, I would like to be able to take a network user
name and determine its membership in network groups so I can list all the
network logins that user has to a SQL server instance. I would like to do
this from T-SQL, if possible.
--
Thank you,
Daniel Jameson
SQL Server DBA
Children's Oncology Group
www.childrensoncologygroup.orgDaniel,
there's not a huge amount of details about ADSI queries, but these links
should help you set it up:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/distributed_query.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_12_94fn.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com|||Paul,
Cool, that looks like a good start. Now I just need to learn those LDAP
queries.
--
Thank you,
Daniel Jameson
SQL Server DBA
Children's Oncology Group
www.childrensoncologygroup.org
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:uIGwD$6xGHA.2396@.TK2MSFTNGP03.phx.gbl...
> Daniel,
> there's not a huge amount of details about ADSI queries, but these links
> should help you set it up:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/distributed_query.asp
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_12_94fn.asp
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
>

Active Directory and SSRS

Is it possible to create a report in SSRS that queries Active Directory data such as user's phone extension, email address etc

What would be a good way to do this?

Thanks,

Nisha

I haven't done this but probably the easiest way will be to use the OLE DB Provider for Microsoft Directory Services. When setting up the data source, choose the OLE DB option and then click the Edit button which will bring you to all OLE DB providers installed.|||

Thank You so much for pointing me in the right direction. I was able to do what I needed.

NB

Thursday, March 8, 2012

Action Queries

Two questions.

1. How do I create action queries in SQL Server? From Enterprise Manager -> view I can create, run but NOT save the query.

2. How do I access an SQL server query from access like i would an Access query? Do i have to make a call to a stored procedure or something like that?If you like to reuse a query you can create it in Query Analyzer and then save it to a file. Using Query Analyzer you can then open the file and run the query. You can use any text editor to create a query and save it. Also by using a stored procedure you are saving the SQL to the database so it can be used at any time just by calling it. Depending on how you setup permission you can let other users call your stored procedure.|||I'm a little new at this so bear with me... OK.. I follow you up to the point of the stored procedure. Say i save that file as Test.. Is test.sql the stored procedure? I thought stored procedures were only available inside Enterprise manager. Lastly Once the file containing the sql statement is created, how do i reference the file from enterprise manager? i can figure out how to call a stored procedure in the enterprise manager from Access VBA code.|||Access_Dude,
Action Queries are a bit different in SQL Server to Access. In access, it all gets saved down in the database. In SQL Server, you've got a choice: Either save it down as a .sql file (in effect a text file - rename the extension to .txt, will open it in Notepad, no problems). This allows you to have a permanent copy which you can open from other apps without needing SQL Server - useful for saving down scripts which you want to run again but don't want to keep in the database.
Or, create a Stored Procedure in SQL Server. This will save the SQL into the database itself. As an example:

select Name, Postcode
from Customer
where CustomerID = 123

... can become a stored proc ('action query')...

create proc spGetCustomerNameAndPostcode
as
select Name, Postcode
from Customer
where CustomerID = 123

... it can then be simply called from an app, or from within SQL Server, using:
exec spGetCustomerNameAndPostcode

(Note that the exec isn't always needed, depends on what you're doing)

Hope this helps :)
Jon.|||Access_Dude,
Action Queries are a bit different in SQL Server to Access. In access, it all gets saved down in the database. In SQL Server, you've got a choice: Either save it down as a .sql file (in effect a text file - rename the extension to .txt, will open it in Notepad, no problems). This allows you to have a permanent copy which you can open from other apps without needing SQL Server - useful for saving down scripts which you want to run again but don't want to keep in the database.
Or, create a Stored Procedure in SQL Server. This will save the SQL into the database itself. As an example:

select Name, Postcode
from Customer
where CustomerID = 123

... can become a stored proc ('action query')...

create proc spGetCustomerNameAndPostcode
as
select Name, Postcode
from Customer
where CustomerID = 123

... it can then be simply called from an app, or from within SQL Server, using:
exec spGetCustomerNameAndPostcode

(Note that the exec isn't always needed, depends on what you're doing)

Hope this helps :)
Jon.

Friday, February 24, 2012

accessing to an oracle 10 linked server

Hello,
i try to make some select queries using a linked oracle 10 server but for a
few tables, only the first row is returned...
i haved used "Microsoft OLE provider for OCBC driver" when declaring my
linked server and my odbc link is using the lastest Oracle odbc driver
(10.1.3.1).
Using another odbc driver (microsoft odbc for oracle) instead of oracle one
make it works great on query analyser but when using it on my programs (who
are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
returning me "Impossible to start other transactions for this session".
Any clue?
Thx
Not sure but you'd definitely want to try using the OLE DB
provider instead. You add extra overhead when using the OLE
DB provider for ODBC. The OLE DB providers generally provide
more functionality as well.
-Sue
On Tue, 15 Mar 2005 07:23:03 -0800, Cdric Prin-Derre
<Cdric Prin-Derre@.discussions.microsoft.com> wrote:

>Hello,
>i try to make some select queries using a linked oracle 10 server but for a
>few tables, only the first row is returned...
>i haved used "Microsoft OLE provider for OCBC driver" when declaring my
>linked server and my odbc link is using the lastest Oracle odbc driver
>(10.1.3.1).
>Using another odbc driver (microsoft odbc for oracle) instead of oracle one
>make it works great on query analyser but when using it on my programs (who
>are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
>returning me "Impossible to start other transactions for this session".
>
>Any clue?
>Thx

accessing to an oracle 10 linked server

Hello,
i try to make some select queries using a linked oracle 10 server but for a
few tables, only the first row is returned...
i haved used "Microsoft OLE provider for OCBC driver" when declaring my
linked server and my odbc link is using the lastest Oracle odbc driver
(10.1.3.1).
Using another odbc driver (microsoft odbc for oracle) instead of oracle one
make it works great on query analyser but when using it on my programs (who
are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
returning me "Impossible to start other transactions for this session".
Any clue?
ThxNot sure but you'd definitely want to try using the OLE DB
provider instead. You add extra overhead when using the OLE
DB provider for ODBC. The OLE DB providers generally provide
more functionality as well.
-Sue
On Tue, 15 Mar 2005 07:23:03 -0800, Cdric Prin-Derre
<Cdric Prin-Derre@.discussions.microsoft.com> wrote:

>Hello,
>i try to make some select queries using a linked oracle 10 server but for a
>few tables, only the first row is returned...
>i haved used "Microsoft OLE provider for OCBC driver" when declaring my
>linked server and my odbc link is using the lastest Oracle odbc driver
>(10.1.3.1).
>Using another odbc driver (microsoft odbc for oracle) instead of oracle one
>make it works great on query analyser but when using it on my programs (who
>are connecting to SQLSERVER 2000 using odbc SQLSERVER), linked request fail
>returning me "Impossible to start other transactions for this session".
>
>Any clue?
>Thx

Sunday, February 12, 2012

Accessing Queries in sqlDataAdapter

Hello Dears;

I have an SqlDataAdapter which contains may queries. One query contians 3 query parameters as follows:

SELECT SUM(Amount) AS Total
FROM Boxes
WHERE EntryDate BETWEEN @.date1 AND @.date2 ANDArea=@.Area

the query cannot be ran unless the queries parameters were provided. I have to access this query in code to add the parameters from controls. Is it possible to access it or use sqlDataSource instead?

Thanks alot

Here is one example I grabed from tutorial with a little modifications for your reference:

Sub GetAuthors_Click(SenderAs Object, EAs EventArgs)

Dim DSAs DataSet
Dim MyConnectionAs SqlConnection
Dim MyCommandAs SqlDataAdapter

Dim strSelectCommandAsString = "select * from Authors where state = @.State"

MyConnection =New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("PubString").ConnectionString
MyCommand =New SqlDataAdapter(strSelectCommand, MyConnection)

MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@.State", SqlDbType.NVarChar, 2))
MyCommand.SelectCommand.Parameters("@.State").Value = someValue 'you need send in

DS =new DataSet()
MyCommand.Fill(DS, "Authors")

Mygv.DataSource=DS.Tables("Authors").DefaultView
Mygv.DataBind()
End Sub

You can add all your parameters to your SqlDataAdapter from your code.

|||Thanks Limno

Accessing Oracle Stored procedures from SQL2K

I have created a linked Oracle server in my SQL2000 environment. I can execute queries just fine. eg select * from DEVX..SCHEMA.TABLE where DEVX is the name of the linked server. However, I cannot seem to execute a stored procedure that is resident on th
e Oracle server
The procedure is called XOKHOUS and the method is UPDADR. It takes a number of parameters and returns a 0 or 1 as a scalar value.
I've tried:
declare @.result int
set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2)
with no luck. Suggestions? Thanks.
> I have created a linked Oracle server in my SQL2000 environment.
> I can execute queries just fine. eg select * from DEVX..SCHEMA.TABLE
> where DEVX is the name of the linked server. However, I cannot seem
> to execute a stored procedure that is resident on the Oracle server
> The procedure is called XOKHOUS and the method is UPDADR. It
> takes a number of parameters and returns a 0 or 1 as a scalar value.
> I've tried:
> declare @.result int
> set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2)
>
> with no luck. Suggestions? Thanks.
>
You can use the OPENQUERY() command to call remote stored procedures. For
more information, please consult your SQL Server Books Online.
Hope this helps,
Eric Crdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.

Accessing Oracle Stored procedures from SQL2K

I have created a linked Oracle server in my SQL2000 environment. I can execu
te queries just fine. eg select * from DEVX..SCHEMA.TABLE where DEVX is the
name of the linked server. However, I cannot seem to execute a stored proce
dure that is resident on th
e Oracle server
The procedure is called XOKHOUS and the method is UPDADR. It takes a numbe
r of parameters and returns a 0 or 1 as a scalar value.
I've tried:
declare @.result int
set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2)
with no luck. Suggestions? Thanks.> I have created a linked Oracle server in my SQL2000 environment.
> I can execute queries just fine. eg select * from DEVX..SCHEMA.TABLE
> where DEVX is the name of the linked server. However, I cannot seem
> to execute a stored procedure that is resident on the Oracle server
> The procedure is called XOKHOUS and the method is UPDADR. It
> takes a number of parameters and returns a 0 or 1 as a scalar value.
> I've tried:
> declare @.result int
> set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2)
>
> with no luck. Suggestions? Thanks.
>
--
You can use the OPENQUERY() command to call remote stored procedures. For
more information, please consult your SQL Server Books Online.
Hope this helps,
Eric Crdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.

Accessing Oracle Stored procedures from SQL2K

I have created a linked Oracle server in my SQL2000 environment. I can execute queries just fine. eg select * from DEVX..SCHEMA.TABLE where DEVX is the name of the linked server. However, I cannot seem to execute a stored procedure that is resident on the Oracle serve
The procedure is called XOKHOUS and the method is UPDADR. It takes a number of parameters and returns a 0 or 1 as a scalar value
I've tried
declare @.result in
set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2
with no luck. Suggestions? Thanks> I have created a linked Oracle server in my SQL2000 environment.
> I can execute queries just fine. eg select * from DEVX..SCHEMA.TABLE
> where DEVX is the name of the linked server. However, I cannot seem
> to execute a stored procedure that is resident on the Oracle server
> The procedure is called XOKHOUS and the method is UPDADR. It
> takes a number of parameters and returns a 0 or 1 as a scalar value.
> I've tried:
> declare @.result int
> set @.result=DEVX..XOKHOUS.UPDADR(@.param1,@.param2)
>
> with no luck. Suggestions? Thanks.
>
--
You can use the OPENQUERY() command to call remote stored procedures. For
more information, please consult your SQL Server Books Online.
Hope this helps,
--
Eric Cárdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.