Showing posts with label call. Show all posts
Showing posts with label call. Show all posts

Friday, March 30, 2012

How to execute

I have a job that requires me to call and execute a SSIS package as the first step in a SQL2k5 Stored Procedure.

Can someone please give me a basic DTEXEC example?

Thanks in advance !Moving to the SSIS forum|||

cheers Louis.

To the OP, perhaps this will help:

Online Beginner Resources
http://blogs.conchango.com/jamiethomson/archive/2007/01/30/SSIS_3A00_-Online-Beginner-Resources.aspx

-Jamie

Wednesday, March 7, 2012

How to do this task

Hi everybody :
I have a small problem,I have a table call ClientRef
ClRefNo Surname Forname Area
1254 Thomson Moore Central
1254 Thomsan Moore South
1253 Noel Watson Central

In this table if i write a sql
select ClRefNo,Surname+ ', ' + Forname as Name, Area from ClientRef
Group by Surname,Forename
Order by Surname
It wil display the result like this way
ClRefNo Name Area
1253 Noel,Watson Central
1254 Thomson,Moore Central
1254 Thomsan,Moore South

Now my problem is, i need to display a * sign when the ClRefNo get repeated ? like this way
ClRefNo Name Area
1253 Noel,Watson * Central
1254 Thomson,Moore * Central
1254 Thomsan,Moore South

how to do this task ?
regards
Suis

use the following query...

Code Snippet

Create Table #data (

[ClRefNo] int ,

[Surname] Varchar(100) ,

[Forname] Varchar(100) ,

[Area] Varchar(100)

);

Insert Into #data Values('1254','Thomson','Moore','Central');

Insert Into #data Values('1254','Thomsan','Moore','South');

Insert Into #data Values('1253','Noel','Watson','Central');

Select

Main.ClRefNo

,Main.Surname + ', ' + Forname + Case When CountData.Counter > 1 Then '*' Else '' End as Name

,Main.Area

From

#data Main

Join (Select ClRefNo, Count(ClRefNo) Counter From #data Group By ClRefNo) as CountData

On Countdata.ClRefNo = Main.ClRefNo

Order by

Surname

|||
HI Manivannan.D.Sekaran
thanks very much for r valuable comments
Ok that query is worling perfectly.
now i got another problem ,Eg: now my table looks like this

ClRefNo Surname Forname RefrlNo Area
1254 Thomson Moore 24 Central
1254 Thomsan Moore 24 South
1253 Noel Watson 12 Central
1253 Noel Watson 13 Central

So now i have got another column call RefrlNo
i need to check if ClRefno is the same and the RefrlNo is same then it should add * sign after the name ? looks like this way

ClRefNo Name Area
1253 Noel,Watson Central
1253 Noel,Watson Central
1254 Thomson,Moore * Central
1254 Thomsan,Moore * South

Any Idea ?|||

Suis,

It's very frustrating for us when someone dribbles out their problem a little bit at a time. It might be useful if you were to just put out the entire issue and allow the folks here to help you find a solution.

I do think that you 'should' be able to take Mani's suggestion and make a simple alteration and solve the issue yourselt. It is almost the identical problem. Have you even bothered to try that?

|||

here you go..

Code Snippet

Create Table #data (

[ClRefNo] int ,

[RefrlNo] int,

[Surname] Varchar(100) ,

[Forname] Varchar(100) ,

[Area] Varchar(100) ,

);

Insert Into #data Values('1254',1,'Thomson','Moore','Central');

Insert Into #data Values('1254',1,'Thomsan','Moore','South');

Insert Into #data Values('1253',1,'Noel','Watson','Central');

Insert Into #data Values('1253',2,'Noel','Watson','Central');

Select

Main.ClRefNo

,Main.Surname + ', ' + Forname + Case When CountData.Counter > 1 Then '*' Else '' End as Name

,Main.Area

From

#data Main

Join (Select ClRefNo,RefrlNo,Count(ClRefNo) Counter From #data Group By ClRefNo,RefrlNo) as CountData

On Countdata.ClRefNo = Main.ClRefNo And Countdata.RefrlNo = Main.RefrlNo

Order by

Surname

|||

Hi Arni,

Yes I tried My self like this way.now i got the output as i expected.



Select

Main.ClRefNo

,Main.Surname + ', ' + Forname + Case When CountData.Counter > 1 Then ' *' Else '' End as Name

,Main.Area

From

#data Main

Join (Select ClRefNo,Refrl_refno Count(ClRefNo) Counter From #data Group By ClRefNo,Refrl_refno) as CountData

On Countdata.ClRefNo = Main.ClRefNo and Countdata.Refrl_refno= #data..Refrl_refno

Order by

Surname

Thank you

regards

suis

|||

Great!

I'm glad that you were helped today, and expecially that you learned that you could take one idea and solve another problem with it. Excellent!

Friday, February 24, 2012

How to do these joins

Pardon my newbieness.
I have four tables to join. I'll just call them Table1, Table2, Table3
and Table4.
Table1 is the main table. I want to do outer joins pointing from fields
in Table1 to fields in each of the other tables. So all records in
Table1 regardless of whether they match in the other tables.
todSelect t1.* from Table1 t1
LEFT JOIN Table2 t2
ON t1.SomeiD = t2.someID
LEFT JOIN Table3 t3
ON t1.SomeiD = t3.someID
...
HTH, Jens Suessmeyer,
http://www.sqlserver2005.de
--
"Tod" <todtown@.swbell.net> schrieb im Newsbeitrag
news:1115757100.280539.176950@.o13g2000cwo.googlegroups.com...
> Pardon my newbieness.
> I have four tables to join. I'll just call them Table1, Table2, Table3
> and Table4.
> Table1 is the main table. I want to do outer joins pointing from fields
> in Table1 to fields in each of the other tables. So all records in
> Table1 regardless of whether they match in the other tables.
> tod
>|||select * from
Table1 left join Table2 on Table1.fld1 = Table2.fld1
left join Table3 on Table1.fld1 = Table3.fld1
left join Table4 on Table1.fld1 = Table4.fld1
"Tod" wrote:

> Pardon my newbieness.
> I have four tables to join. I'll just call them Table1, Table2, Table3
> and Table4.
> Table1 is the main table. I want to do outer joins pointing from fields
> in Table1 to fields in each of the other tables. So all records in
> Table1 regardless of whether they match in the other tables.
> tod
>|||Conceptually. each "Join" is a join between only two "Relations", or
"Resultsets". When you have more than two tables in a From Clause, and,
therefore, you have two or more joins. the second "Join" that takes place ca
n
be thought of as a Join between the intermediate resultset created by the
first join, and the third table. So the answer to your question depends on
what order, and what exactly, you wish to Join in this second Join... (and
then the third Join...)
Two possibilities exist:
You could Join Tables B to A, using Outer Join syntax, and then Join C to
that resultset, also using Outer Join SyntAX...
From TableA
Left Outer Join Table B On .....
Left Outer Join Table C On ......
Or 2) you might be wishing to Join the COmbined Inner Join of Tables B & C
to Table A. In this case you would be joining B & C FIrst, and then Joining
THAT resultset to TableA using Outer Join Syntax
From TableA
Left Outer Join (Table B Join Table C On ....)
On ....
This approach might be used to get ALL Customers, (even the ones with no
Invoices), plus the data from a Invoices and connected Invoice Details table
s
, but only include invoices that have details...
"Tod" wrote:

> Pardon my newbieness.
> I have four tables to join. I'll just call them Table1, Table2, Table3
> and Table4.
> Table1 is the main table. I want to do outer joins pointing from fields
> in Table1 to fields in each of the other tables. So all records in
> Table1 regardless of whether they match in the other tables.
> tod
>

Sunday, February 19, 2012

How to do async execution

Is there any way to call several stored procedure asynchronously from within
another SP ?
I want to execute several SPs in paralle, calling them insidia a SP.
Something like:
stored proc sp1
begin
...
exec mySP1 (async)
exec mySP2 (async)
exec mySP3 (async)
end
so SP2 doesn;t have to wait unit SP1 finishes.
Thanks.i don't know if WAITFOR will work but have you tried it?
"PeyoQuintero" <pedroquintero@.earthlink.net> wrote in message
news:BK_8d.6601$Vm1.5770@.newsread3.news.atl.earthlink.net...
> Is there any way to call several stored procedure asynchronously from
> within
> another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
>|||PeyoQuintero wrote:
> Is there any way to call several stored procedure asynchronously from
> within another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
Asynchronous operation is really the domain of the client library and
would normally require multiple connections to the server. You can kick
off three separate jobs from SQL Server Agent that would call the three
SPs. You could also kick off three separate tasks from Windows task
manager that start OSQL sessions.
You could define the jobs interactively inside a SP and kick them off
one after the other. Each job would use a separate connection and they
would run simultaneously. To do this, create the jobs from SQL
Enterprise Manager and then script them out to see the TSQL to use. I
think you can define the jobs to auto-delete once they are finished.
David Gugick
Imceda Software
www.imceda.com|||I would do it from an application logic (vb.net / c# ...)
I never looked into how you ca achieve it with t-sql, apart if you are a
die hard and write an extended sp...
PeyoQuintero wrote:
> Is there any way to call several stored procedure asynchronously from within
> another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
>

How to do async execution

Is there any way to call several stored procedure asynchronously from within
another SP ?
I want to execute several SPs in paralle, calling them insidia a SP.
Something like:
stored proc sp1
begin
....
exec mySP1 (async)
exec mySP2 (async)
exec mySP3 (async)
end
so SP2 doesn;t have to wait unit SP1 finishes.
Thanks.
i don't know if WAITFOR will work but have you tried it?
"PeyoQuintero" <pedroquintero@.earthlink.net> wrote in message
news:BK_8d.6601$Vm1.5770@.newsread3.news.atl.earthl ink.net...
> Is there any way to call several stored procedure asynchronously from
> within
> another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
>
|||PeyoQuintero wrote:
> Is there any way to call several stored procedure asynchronously from
> within another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
Asynchronous operation is really the domain of the client library and
would normally require multiple connections to the server. You can kick
off three separate jobs from SQL Server Agent that would call the three
SPs. You could also kick off three separate tasks from Windows task
manager that start OSQL sessions.
You could define the jobs interactively inside a SP and kick them off
one after the other. Each job would use a separate connection and they
would run simultaneously. To do this, create the jobs from SQL
Enterprise Manager and then script them out to see the TSQL to use. I
think you can define the jobs to auto-delete once they are finished.
David Gugick
Imceda Software
www.imceda.com
|||I would do it from an application logic (vb.net / c# ...)
I never looked into how you ca achieve it with t-sql, apart if you are a
die hard and write an extended sp...
PeyoQuintero wrote:
> Is there any way to call several stored procedure asynchronously from within
> another SP ?
> I want to execute several SPs in paralle, calling them insidia a SP.
> Something like:
> stored proc sp1
> begin
> ...
> exec mySP1 (async)
> exec mySP2 (async)
> exec mySP3 (async)
>
> end
> so SP2 doesn;t have to wait unit SP1 finishes.
> Thanks.
>