Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Not displaying Columns in OLEDB Source


Not displaying Columns in OLEDB Source

Author
Message
sqlusers
sqlusers
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 512
Folks,

I have a script which has while loop and the same script working fine in Management Studio. But if i use the same set of script in OLEDB Source it not displaying any of the columns in OLEDB Source Editor.

If i remove the while loop it display all the columns as expected. Can help me how to solve this?

Appreciate your Help!!!
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8404 Visits: 19504
Why does your data source contain a WHILE loop?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Leo Suresh
Leo Suresh
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 40
Try including SET NOCOUNT ON in the begining of your SQL script that is used in OLEDB source task.
sqlusers
sqlusers
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 512
Phil Parkin (10/5/2010)
Why does your data source contain a WHILE loop?


Actually, i need to get the data's according to From and To Date from a table. So for that i used this while loop.

Even i used NOCOUNT ON. But sorry i didn't get the columns yet.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8404 Visits: 19504
sqlusers (10/5/2010)
Phil Parkin (10/5/2010)
Why does your data source contain a WHILE loop?


Actually, i need to get the data's according to From and To Date from a table. So for that i used this while loop.

Even i used NOCOUNT ON. But sorry i didn't get the columns yet.


Why not a WHERE clause? Sounds like you're getting the records one at a time?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Leo Suresh
Leo Suresh
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 40
I guess you are using table variable inside your SQL query. If that is the case, then OLEDB source task will not generate the columns.
Use a stored procedure instead of the SQL script, this will generate the columns.
sqlusers
sqlusers
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 512
Leo Suresh (10/5/2010)
I guess you are using table variable inside your SQL query. If that is the case, then OLEDB source task will not generate the columns.
Use a stored procedure instead of the SQL script, this will generate the columns.


ohh... yes, i use table variable inside. Let me check. Thanks Leo.
sqlusers
sqlusers
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 512


Why not a WHERE clause? Sounds like you're getting the records one at a time?



Exactly i want to get all the data's. That'y i use loop through.

Here in table my StartDate can be From and To date is one and the same. For ex, if i run the script today, My From and To Date [table columns] can be today. If i run my Script tomorrow my From and To Date [table columns] can be tomorrow.

Exactly my script is like this.

DECLARE @StartDate DATETIME,@LEndDate DATETIME,@EndDate DATETIME

@StartDate = '2010-10-02'
@LEndDate = '2010-10-05'

WHILE @StartDate <= @LEndDate
BEGIN
SET @StartDate = @StartDate
SET @EndDate = @StartDate

<Insert Statement>
<SELECT Statement WHERE FromDate = @StartDate AND ToDate = @EndDate>

<Calculation Part>
SET @StartDate = @StartDate + 1
END

<SELECT ST>
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8404 Visits: 19504
sqlusers (10/5/2010)


Why not a WHERE clause? Sounds like you're getting the records one at a time?



Exactly i want to get all the data's. That'y i use loop through.

Here in table my StartDate can be From and To date is one and the same. For ex, if i run the script today, My From and To Date [table columns] can be today. If i run my Script tomorrow my From and To Date [table columns] can be tomorrow.

Exactly my script is like this.

DECLARE @StartDate DATETIME,@LEndDate DATETIME,@EndDate DATETIME

@StartDate = '2010-10-02'
@LEndDate = '2010-10-05'

WHILE @StartDate <= @LEndDate
BEGIN
SET @StartDate = @StartDate
SET @EndDate = @StartDate

<Insert Statement>
<SELECT Statement WHERE FromDate = @StartDate AND ToDate = @EndDate>

<Calculation Part>
SET @StartDate = @StartDate + 1
END

<SELECT ST>


Why not this

select statement
where FromDate >= '2010-10-02' and ToDate <= '2010-10-05'


?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
sqlusers
sqlusers
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 512
Why not this

select statement
where FromDate >= '2010-10-02' and ToDate <= '2010-10-05'


?[/quote]

yes, Thanks Phil. I am going like Horse eye. w00t
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search