Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Monday, March 19, 2012

a text file data source

I would know how to create a report which has as data source a text file

someone can help me?

Hi Maaloul-

To retrieve data directly from a text file, you would need to implement your own custom data extension. A sample data extension can be found here:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B8468707-56EF-4864-AC51-D83FC3273FE5

-Jon

|||Another option is to create an ODBC connection to the text file. This has been written up several times.

a text file data source

I would know how to create a report which has as data source a text file

someone can help me?

Hi Maaloul-

To retrieve data directly from a text file, you would need to implement your own custom data extension. A sample data extension can be found here:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B8468707-56EF-4864-AC51-D83FC3273FE5

-Jon

|||Another option is to create an ODBC connection to the text file. This has been written up several times.

A text file data source

Hi all,
I have to write a report that uses a .txt file as a data-source and I
am not sure how to do that.
Anyone know where I can find out how to set this up? ODBC Connection?
The .txt file format is like this...(top 5 rows)
20040881 2004/12/22 01:30:12 NONIMPACT
20040883 2004/12/22 15:02:12 NONIMPACT
20040884 2004/12/22 17:52:12 NONIMPACT
20040885 2004/12/23 11:20:12 NONIMPACT
20040891 2004/12/23 15:10:12 NONIMPACT
and so one....
Any help would be great!!!!!!!!!!!!
Thanks, KerrieI've never tried to reach a flat text file, but I do not think that SRS
supports connecting directly to a flat file...(correct me if I am
wrong).
You may have to write your own data processing extension that can
connect to the files you want and extract the data therein. Hope this
helps!
Lance M.
Kerrie wrote:
> Hi all,
> I have to write a report that uses a .txt file as a data-source and I
> am not sure how to do that.
> Anyone know where I can find out how to set this up? ODBC Connection?
> The .txt file format is like this...(top 5 rows)
> 20040881 2004/12/22 01:30:12 NONIMPACT
> 20040883 2004/12/22 15:02:12 NONIMPACT
> 20040884 2004/12/22 17:52:12 NONIMPACT
> 20040885 2004/12/23 11:20:12 NONIMPACT
> 20040891 2004/12/23 15:10:12 NONIMPACT
> and so one....
> Any help would be great!!!!!!!!!!!!
> Thanks, Kerrie|||Create a linked data source of type CSV to the flat file and use it in
your report against the text file.
Lance M wrote:
> I've never tried to reach a flat text file, but I do not think that SRS
> supports connecting directly to a flat file...(correct me if I am
> wrong).
> You may have to write your own data processing extension that can
> connect to the files you want and extract the data therein. Hope this
> helps!
> Lance M.
> Kerrie wrote:
> > Hi all,
> > I have to write a report that uses a .txt file as a data-source and I
> > am not sure how to do that.
> >
> > Anyone know where I can find out how to set this up? ODBC Connection?
> >
> > The .txt file format is like this...(top 5 rows)
> > 20040881 2004/12/22 01:30:12 NONIMPACT
> > 20040883 2004/12/22 15:02:12 NONIMPACT
> > 20040884 2004/12/22 17:52:12 NONIMPACT
> > 20040885 2004/12/23 11:20:12 NONIMPACT
> > 20040891 2004/12/23 15:10:12 NONIMPACT
> >
> > and so one....
> >
> > Any help would be great!!!!!!!!!!!!
> >
> > Thanks, Kerrie

Sunday, February 19, 2012

A problem with DTS Import/Export wizard....

Hello,
I am trying to replace data in the "region" column in table 2 with data in
the "region" column in table 1...in other words 1 is the source and 2 is the
destination. I go thru the wizard and then use a query to specify the data
to transfer. I go into the query builder and select the column that I want
transfered. I don't specify a sort order or criteria. The query statement
is thus:
select [Customers].[Region]
from [Customers]
easy enough...
I then select the source table and click transform and I do not see an
option to replace the data only append, create destination table, and delete
rows in destination table.
Is this all the functionality of the wizard gives me?
Do I need to create my own script?
Thanks
Ken S.I am sure that someone can help, but we will need some additional =information...
Do the tables (table1 and table2) share a common column that you can =JOIN on in order to perform an update?
What other data exists within Table2? Does all the data come from =Table1? Can you simply delete all the rows within Table2 and insert =from Table1?
-- Keith
"SMAN" <ksanti@.nycap.rr.com> wrote in message =news:eJUmwnjxDHA.2456@.TK2MSFTNGP12.phx.gbl...
> Hello,
> > I am trying to replace data in the "region" column in table 2 with =data in
> the "region" column in table 1...in other words 1 is the source and 2 =is the
> destination. I go thru the wizard and then use a query to specify the =data
> to transfer. I go into the query builder and select the column that I =want
> transfered. I don't specify a sort order or criteria. The query =statement
> is thus:
> > select [Customers].[Region]
> from [Customers]
> > easy enough...
> > I then select the source table and click transform and I do not see an
> option to replace the data only append, create destination table, and =delete
> rows in destination table.
> > Is this all the functionality of the wizard gives me?
> > Do I need to create my own script?
> > Thanks
> > Ken S.
> >|||Thanks Keith...
both tables are identical tables with the same structure and row count. The
region column in table 1 is the data I want in table 2's region column.
Perhaps your solution of deleting all the rows in table 2 and replacing with
table 1 rows is the way to go.
Thanks
Ken
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
news:ejEZiujxDHA.2328@.TK2MSFTNGP10.phx.gbl...
I am sure that someone can help, but we will need some additional
information...
Do the tables (table1 and table2) share a common column that you can JOIN on
in order to perform an update?
What other data exists within Table2? Does all the data come from Table1?
Can you simply delete all the rows within Table2 and insert from Table1?
--
Keith
"SMAN" <ksanti@.nycap.rr.com> wrote in message
news:eJUmwnjxDHA.2456@.TK2MSFTNGP12.phx.gbl...
> Hello,
> I am trying to replace data in the "region" column in table 2 with data in
> the "region" column in table 1...in other words 1 is the source and 2 is
the
> destination. I go thru the wizard and then use a query to specify the
data
> to transfer. I go into the query builder and select the column that I
want
> transfered. I don't specify a sort order or criteria. The query
statement
> is thus:
> select [Customers].[Region]
> from [Customers]
> easy enough...
> I then select the source table and click transform and I do not see an
> option to replace the data only append, create destination table, and
delete
> rows in destination table.
> Is this all the functionality of the wizard gives me?
> Do I need to create my own script?
> Thanks
> Ken S.
>|||Since the tables are identical you could also update the data with an =update statement:
UPDATE table2 SET region =3D B.region
FROM table2 A JOIN table1 B ON A.ThePrimaryKeyColumn =3D =B.ThePrimaryKeyColumn
SELECT @.@.rowcount
-- Keith
"SMAN" <ksanti@.nycap.rr.com> wrote in message =news:uKByO2jxDHA.3116@.tk2msftngp13.phx.gbl...
> Thanks Keith...
> > both tables are identical tables with the same structure and row =count. The
> region column in table 1 is the data I want in table 2's region =column.
> Perhaps your solution of deleting all the rows in table 2 and =replacing with
> table 1 rows is the way to go.
> > Thanks
> > Ken
> > > "Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
> news:ejEZiujxDHA.2328@.TK2MSFTNGP10.phx.gbl...
> I am sure that someone can help, but we will need some additional
> information...
> > Do the tables (table1 and table2) share a common column that you can =JOIN on
> in order to perform an update?
> > What other data exists within Table2? Does all the data come from =Table1?
> Can you simply delete all the rows within Table2 and insert from =Table1?
> > --
> Keith
> > > "SMAN" <ksanti@.nycap.rr.com> wrote in message
> news:eJUmwnjxDHA.2456@.TK2MSFTNGP12.phx.gbl...
> > Hello,
> >
> > I am trying to replace data in the "region" column in table 2 with =data in
> > the "region" column in table 1...in other words 1 is the source and =2 is
> the
> > destination. I go thru the wizard and then use a query to specify =the
> data
> > to transfer. I go into the query builder and select the column that =I
> want
> > transfered. I don't specify a sort order or criteria. The query
> statement
> > is thus:
> >
> > select [Customers].[Region]
> > from [Customers]
> >
> > easy enough...
> >
> > I then select the source table and click transform and I do not see =an
> > option to replace the data only append, create destination table, =and
> delete
> > rows in destination table.
> >
> > Is this all the functionality of the wizard gives me?
> >
> > Do I need to create my own script?
> >
> > Thanks
> >
> > Ken S.
> >
> >
> >

Thursday, February 9, 2012

A field or property with the name Jan was not found on the selected data source.

I have this Stored Procedure:

Create PROCEDURE ListEvent
as
If MONTH(GetDate()) <= 6
Begin
SELECT EventTitle, EventDuration,
(CASE WHEN MONTH(StartDate) = 1 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jan',
(CASE WHEN MONTH(StartDate) = 2 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Feb',
(CASE WHEN MONTH(StartDate) = 3 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Mar',
(CASE WHEN MONTH(StartDate) = 4 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Apr',
(CASE WHEN MONTH(StartDate) = 5 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'May',
(CASE WHEN MONTH(StartDate) = 6 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jun'
FROM dbo.tblEvent INNER JOIN dbo.tbl ON (tblEvent.EventID = tblEventdate.EventID)
WHERE YEAR(StartDate) = Year(GetDate())
group by EventTitle, EventDuration,StartDate,EndDate
End
Else
Begin
SELECT EventTitle, EventDuration,
(CASE WHEN MONTH(StartDate) = 7 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jul',
(CASE WHEN MONTH(StartDate) = 8 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Aug',
(CASE WHEN MONTH(StartDate) = 9 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Sep',
(CASE WHEN MONTH(StartDate) = 10 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Oct',
(CASE WHEN MONTH(StartDate) = 11 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Nov',
(CASE WHEN MONTH(StartDate) = 12 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Dec'
FROM dbo.tblEvent INNER JOIN dbo.tbl ON (tblEvent.EventID = tblEventdate.EventID)
WHERE YEAR(StartDate) = Year(GetDate())
group by EventTitle, EventDuration,StartDate,EndDate
End

When I execute it in the SQLExpress, the result returned as expected. But when I bind to Gridview I got this error:

A field or property with the name 'Jan' was not found on the selected data source.

How do I solve this?

I am using drag and drop SQLDatasource to call the Stored Proc and VB.net is the language. Thanks

This is because when you set AS 'Jan', your table's coloumn name is JAN now. If your first Statement If MONTH(GetDate()) <= 6 is true, you have column JAN, it should work. But, if this is not true, you don't have column JAN, you get error.

|||

I tried and it does give me the problem. Is there a workaround for this? Thanks

|||

Can you try this?

1) Modify your SP, add '' for other month to make whole year like:

SELECT EventTitle, EventDuration,
(CASE WHEN MONTH(StartDate) = 1 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jan',
(CASE WHEN MONTH(StartDate) = 2 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Feb',
(CASE WHEN MONTH(StartDate) = 3 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Mar',
(CASE WHEN MONTH(StartDate) = 4 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Apr',
(CASE WHEN MONTH(StartDate) = 5 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'May',
(CASE WHEN MONTH(StartDate) = 6 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jun',

'' AS 'Jul',

'' AS 'Aug'

... for other month
FROM dbo.tblEvent INNER JOIN dbo.tbl ON (tblEvent.EventID = tblEventdate.EventID)
WHERE YEAR(StartDate) = Year(GetDate())
group by EventTitle, EventDuration,StartDate,EndDate

Do same thing for your second condition.

2). I am not sure which Data Control you used. Try to hide the column if the column value is ''.

(I am not sure the number 2 workable or not. Anyway, try to hide it).

|||

Ok, it is done. thanks