Thursday, March 29, 2012

Embeded case in where clause - causing problems.

Hi.
I have a sp that allows the user to search based on a variable set of parame
ters for example just a home phone or just a buss. phone however when search
ing by last name the user also has to supply the ZIP
optionally he can filter that search by first name or address. I am trying t
o accomplish that by using embede cases - the procedure compiles - but I do
not get the results I want
For example if i pass in '%s%' for @.Lastname and '%1%' for zip - it does not
work - I am sure that are fields with those values in the db
(note: everying worked as expected before I added the embeded cases (and wil
dcard stuff))
the following is the SP - (sorry for the long snippet)
ALTER procedure GetDupCheckResults
(
@.HomePhone varchar(50),
@.BussPhone varchar(50),
@.Email varchar(50),
@.LastName varchar(50),
@.FirstName varchar(50),
@.Address varchar(50),
@.FirmZip varchar(50),
@.PersonZip varchar(50),
@.FirmName varchar(50)
)
as
begin
SELECT nmfid, nmffirst, nmflast, nafcompany, nafadd1, nafadd2, naftype +
' (' + nafdesc + ') ' AS [Adress Type], npfarea + '-' + npfphone AS Phone
FROM
(
select v_nmf_naf_npf_linked.* from
v_nmf_naf_npf_linked inner join
(
Select distinct npfseq from
(
select
npfseq,'HomePhone' FoundSource
from
v_nmf_naf_npf_Linked
where
npfArea + '-' + NPFPhone = @.HomePhone
and
naftype = 'HOME'
and
(
@.HomePhone <> ''
and
@.HomePhone <> '%%'
)
union
select
npfseq,'BussPhone'
from
v_nmf_naf_npf_Linked
where
npfArea+'-'+NPFPhone = @.BussPhone
and
naftype = 'BF'
and
@.BussPhone <> ''
union
select
npfseq,'NameAddress'
from
V_nmf_naf_npf_Linked
where
@.PersonZIP like nafzip
and
@.LastName like nmflast
and
-- optionally allow filter on address and last name
1 =
Case @.Address
When '' then 1
When '%%' then 1 -- when wild cards are in use
Else
(
Case
when @.Address like nafAdd1 then 1
when @.Address like nafAdd2 then 1
else
0
end
)
end
and
1 =
Case @.LastName
When '' then 1
When '%%' then 1
Else
(
Case
when @.Lastname like nmfLast then 1
else 0
end
)
end
and not
(
(@.LastName = '' or @.PersonZip = '')
or
(@.LastName = '%%' or @.PersonZip = '%%')
)
union
select
npfseq,'Company'
from
V_nmf_naf_npf_Linked
where
nafZip like @.FirmZip
and
nafCompany like @.FirmName
and not @.FirmName = ''
and not @.FirmZip = ''
and not @.FirmName = '%%'
and not @.FirmZip = '%%'
)Temptab
)
unionResult on unionResult.npfseq = v_nmf_naf_npf_Linked.npfseq
) dd
end
thank you for slogging thru it.You are sure you have people with the last name '%s%' and zip '%1%'?
What country is this?
Most likely you don't have such data in your database, but that is exactly
what this code will try to find, since your condition (on last name, for
example) is
@.Lastname like nmfLast
While this stored procedure looks far more complicated than it needs to
be, my guess is that you want
nmfLast LIKE @.Lastname
instead of the other way around.
Steve Kass
Drew University
Madler wrote:

>Hi.
>I have a sp that allows the user to search based on a variable set of param
eters for example just a home phone or just a buss. phone however when searc
hing by last name the user also has to supply the ZIP
>optionally he can filter that search by first name or address. I am trying
to accomplish that by using embede cases - the procedure compiles - but I do
not get the results I want
>For example if i pass in '%s%' for @.Lastname and '%1%' for zip - it does no
t work - I am sure that are fields with those values in the db
>(note: everying worked as expected before I added the embeded cases (and wi
ldcard stuff))
>the following is the SP - (sorry for the long snippet)
>ALTER procedure GetDupCheckResults
>(
> @.HomePhone varchar(50),
> @.BussPhone varchar(50),
> @.Email varchar(50),
> @.LastName varchar(50),
> @.FirstName varchar(50),
> @.Address varchar(50),
> @.FirmZip varchar(50),
> @.PersonZip varchar(50),
> @.FirmName varchar(50)
> )
>as
>begin
>SELECT nmfid, nmffirst, nmflast, nafcompany, nafadd1, nafadd2, naftype
+ ' (' + nafdesc + ') ' AS [Adress Type], npfarea + '-' + npfphone AS Phone
>FROM
>(
>select v_nmf_naf_npf_linked.* from
> v_nmf_naf_npf_linked inner join
> (
> Select distinct npfseq from
> (
> select
> npfseq,'HomePhone' FoundSource
> from
> v_nmf_naf_npf_Linked
> where
> npfArea + '-' + NPFPhone = @.HomePhone
> and
> naftype = 'HOME'
> and
> (
> @.HomePhone <> ''
> and
> @.HomePhone <> '%%'
> )
> union
> select
> npfseq,'BussPhone'
> from
> v_nmf_naf_npf_Linked
> where
> npfArea+'-'+NPFPhone = @.BussPhone
> and
> naftype = 'BF'
> and
> @.BussPhone <> ''
> union
> select
> npfseq,'NameAddress'
> from
> V_nmf_naf_npf_Linked
> where
> @.PersonZIP like nafzip
> and
> @.LastName like nmflast
> and
> -- optionally allow filter on address and last name
> 1 =
> Case @.Address
> When '' then 1
> When '%%' then 1 -- when wild cards are in use
> Else
> (
> Case
> when @.Address like nafAdd1 then 1
> when @.Address like nafAdd2 then 1
> else
> 0
> end
> )
> end
> and
> 1 =
> Case @.LastName
> When '' then 1
> When '%%' then 1
> Else
> (
> Case
> when @.Lastname like nmfLast then 1
> else 0
> end
> )
> end
> and not
> (
> (@.LastName = '' or @.PersonZip = '')
> or
> (@.LastName = '%%' or @.PersonZip = '%%')
> )
>
> union
> select
> npfseq,'Company'
> from
> V_nmf_naf_npf_Linked
> where
> nafZip like @.FirmZip
> and
> nafCompany like @.FirmName
> and not @.FirmName = ''
> and not @.FirmZip = ''
> and not @.FirmName = '%%'
> and not @.FirmZip = '%%'
>
> )Temptab
> )
> unionResult on unionResult.npfseq = v_nmf_naf_npf_Linked.npfseq
> ) dd
>end
>
>thank you for slogging thru it.
>
>

Embedding/Distributing SQL Express With A VB Program

If I want to distribute a VB database programm using MSDE I have to install MSDE seperately which can be a challenge for some users. It there a way I could deploy SQL Express with my VB program so the user would not have to do a seperate install? Is this possible in Visual Studio 2003 or do I need 2005?

Thanks

Have a look at the following MSDN Article, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/EmSQLExCustApp.asp

sql

Embedding SQL Server Express in the installer

Can we embed the SQL Server Express in the windows installer jsut like the XML files or the Ms access database?You are referring to the windows installer in VS 2005 I suppose ??
It is not possible in the installer of VS 2003, but I suppose it can be done with Whidbey ... I haven't tried it yet though ...|||The following information may provide clarification regarding the same;

Can I redistribute SQL Express?
http://blogs.msdn.com/sqlexpress/archive/2004/07/04/172952.aspx

embedding RS into a java (j2ee) application

Can anyone point me to some useful information on embedding reports into a
java (J2EE) application?
StephanieNot specifically but I can tell you your options. There are three ways to
integrate reports into an application: roll your own with web services, use
URL integration, use the reportviewer control that comes with VS 2005. Of
these you can use the first two. The control is a 2.0 framework control and
is of no use to you.
The easiest is URL access(search BOL for URL).
Report Manager itself uses web services (Report Manager is really just a
portal that ships with RS. It does nothing that you can't do yourself with
published web services)
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Stephanie" <Stephanie@.discussions.microsoft.com> wrote in message
news:015E15B4-EFDB-422C-917E-B6E7ECACACB5@.microsoft.com...
> Can anyone point me to some useful information on embedding reports into a
> java (J2EE) application?
> Stephanie|||Thanks, Bruce. I can see how you can hide the Toolbar if you want to
(&rc:Toolbar=false). Is there a way to hide sections above the toolbar?
Basically, I want the user to only see the Toolbar and below within the app.
Perhaps the application can manage the Back button functionality?
Also, another quick question: Can you hide the report header and footer with
this sort of option or would you have to add hidden parameters to do that?
Some reports are used within the app and outside the app. When inside the
app, I do not want the report header and footer to show. I'm thinking I have
to add yet another hidden parameter.
S.
"Bruce L-C [MVP]" wrote:
> Not specifically but I can tell you your options. There are three ways to
> integrate reports into an application: roll your own with web services, use
> URL integration, use the reportviewer control that comes with VS 2005. Of
> these you can use the first two. The control is a 2.0 framework control and
> is of no use to you.
> The easiest is URL access(search BOL for URL).
> Report Manager itself uses web services (Report Manager is really just a
> portal that ships with RS. It does nothing that you can't do yourself with
> published web services)
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Stephanie" <Stephanie@.discussions.microsoft.com> wrote in message
> news:015E15B4-EFDB-422C-917E-B6E7ECACACB5@.microsoft.com...
> > Can anyone point me to some useful information on embedding reports into a
> > java (J2EE) application?
> >
> > Stephanie
>
>|||You can hid the parameter area too. This link shows the things you can
control for the html viewer. I tend to hide the parameter area but not the
toolbar.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/rptsprg9/html/1c3e680a-83ea-4979-8e79-fa2337ae12a3.htm
Correct about the hidden parameter for the report header and footer.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Stephanie" <Stephanie@.discussions.microsoft.com> wrote in message
news:DD1721F3-3164-479A-BB25-AB4218CA6E40@.microsoft.com...
> Thanks, Bruce. I can see how you can hide the Toolbar if you want to
> (&rc:Toolbar=false). Is there a way to hide sections above the toolbar?
> Basically, I want the user to only see the Toolbar and below within the
> app.
> Perhaps the application can manage the Back button functionality?
> Also, another quick question: Can you hide the report header and footer
> with
> this sort of option or would you have to add hidden parameters to do that?
> Some reports are used within the app and outside the app. When inside the
> app, I do not want the report header and footer to show. I'm thinking I
> have
> to add yet another hidden parameter.
> S.
> "Bruce L-C [MVP]" wrote:
>> Not specifically but I can tell you your options. There are three ways to
>> integrate reports into an application: roll your own with web services,
>> use
>> URL integration, use the reportviewer control that comes with VS 2005. Of
>> these you can use the first two. The control is a 2.0 framework control
>> and
>> is of no use to you.
>> The easiest is URL access(search BOL for URL).
>> Report Manager itself uses web services (Report Manager is really just a
>> portal that ships with RS. It does nothing that you can't do yourself
>> with
>> published web services)
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Stephanie" <Stephanie@.discussions.microsoft.com> wrote in message
>> news:015E15B4-EFDB-422C-917E-B6E7ECACACB5@.microsoft.com...
>> > Can anyone point me to some useful information on embedding reports
>> > into a
>> > java (J2EE) application?
>> >
>> > Stephanie
>>

Embedding reports in Winform App...

I am looking for options for rendering RDLs in a .Net 1.1 Windows Forms
application using SQL Server 2K.
Thanks everyone.Use fyiReporting component (http://www.fyireporting.com). Is open source and
read RDL files with Windows Forms Viewer component.
[]s
"Terry Mulvany" <terry.mulvany@.rouseservices.com> escreveu na mensagem
news:eh4oCnMqFHA.2072@.TK2MSFTNGP14.phx.gbl...
>I am looking for options for rendering RDLs in a .Net 1.1 Windows Forms
>application using SQL Server 2K.
> Thanks everyone.
>|||Thanks Pedro, do you or anyone else know of any similar 3rd party (pay or
open source) components that actually use the infrastructure of SQL Server
Reporting Services (i.e. ReportServer web service and it's corresponding
security) rather than just simply being able to load an RDL file and view it
as the FYIReporting stuff does.
(I know .Net 2.0 and Yukon will support this but we do not have that as an
option)
Thanks all.
-Terry
"Pedro Jr." <pedro.alvesjr@.gmail.com> wrote in message
news:epT5CvMqFHA.2776@.TK2MSFTNGP10.phx.gbl...
> Use fyiReporting component (http://www.fyireporting.com). Is open source
> and read RDL files with Windows Forms Viewer component.
> []s
>
> "Terry Mulvany" <terry.mulvany@.rouseservices.com> escreveu na mensagem
> news:eh4oCnMqFHA.2072@.TK2MSFTNGP14.phx.gbl...
>>I am looking for options for rendering RDLs in a .Net 1.1 Windows Forms
>>application using SQL Server 2K.
>> Thanks everyone.
>|||You can use web services to return a stream rendered how you want and then
display that (pdf, excel, html, etc). Or you can use URL integration. Put a
IE browser control and set its URL appropriately. With .Net 2.0 where will
be a winform control which will make all of this extremely easy.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Terry Mulvany" <terry.mulvany@.rouseservices.com> wrote in message
news:eh4oCnMqFHA.2072@.TK2MSFTNGP14.phx.gbl...
>I am looking for options for rendering RDLs in a .Net 1.1 Windows Forms
>application using SQL Server 2K.
> Thanks everyone.
>

Embedding reporting services as a standalone product

Hi,
In the application that I am working on, we currently use Crystal Reports as
the embedded reporting engine. I am trying to evaluate if we should move
over to Microsoft Reporting Services. However, one thing confuses me. It
seems Microsoft Reporting Services will work only as a server under IIS.
This will not work for our customers. I am wondering if Reporting Services
has any embedded component much like Crystal Reports that we could use.
Thank you in advance for your help.
SunnyVersion 2 will have a web form and a winform that does not require the
server (works with the server if there but does not require it).
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Sansanee" <sansanee@.nospam.com> wrote in message
news:%23LD40RJ3EHA.1144@.TK2MSFTNGP09.phx.gbl...
> Hi,
> In the application that I am working on, we currently use Crystal Reports
as
> the embedded reporting engine. I am trying to evaluate if we should move
> over to Microsoft Reporting Services. However, one thing confuses me. It
> seems Microsoft Reporting Services will work only as a server under IIS.
> This will not work for our customers. I am wondering if Reporting Services
> has any embedded component much like Crystal Reports that we could use.
> Thank you in advance for your help.
> Sunny
>

Embedding plug-ins in Reports

Hi,
I am trying to figure out the way to embed a plug-in (Chime for Windows)
into my report, so that I can display a certain object from a database, that
is stored there as a string. This Chime plug-in would read the input string
and convert it to video display.
This embedding is easily done in simple HTML:
<embed type='chemical/x-mdl-molfile' display2d=true width=200 height=200
hlabels2d='terminalhetero' structure= [encrypted string from the database
follows]>
I am wondering is there a way to do such embedding straight into my report
by using the report designer features or by modifying an RDL file for my
report?
Thank you.
Anton Bagayev,
TransForm Pharmaceuticals, Inc.
29 Hartwell Avenue
Lexington, MA 02421Or even simpler, is it possible to embed an HTML in a report.
That would be an exiting idea.
Thanks in advance.
Anton.
"Anton" wrote:
> Hi,
> I am trying to figure out the way to embed a plug-in (Chime for Windows)
> into my report, so that I can display a certain object from a database, that
> is stored there as a string. This Chime plug-in would read the input string
> and convert it to video display.
> This embedding is easily done in simple HTML:
> <embed type='chemical/x-mdl-molfile' display2d=true width=200 height=200
> hlabels2d='terminalhetero' structure= [encrypted string from the database
> follows]>
> I am wondering is there a way to do such embedding straight into my report
> by using the report designer features or by modifying an RDL file for my
> report?
> Thank you.
> Anton Bagayev,
> TransForm Pharmaceuticals, Inc.
> 29 Hartwell Avenue
> Lexington, MA 02421sql

Embedding picture in local report header

Okay. Simple request. I have a local report in my VS2005 project. I want to embed my company logo in the header. How do I do this? When I put an image item on the page it wants me to put something in the value for this? I've tried sending through a dataset but SSRS can't load data set information into the header! Why is this so complicated? I don't want to embed a dynamic database image, just a static image that will be embedded in my program. Any help on this would be appreciated.

Thanks,

Jon

Drag and drop an image control to the page header. Select embedded image. Click New image. Select the image that you want to embed. Then click finish. Build and deploy the report. Voila!

|||

This works fine for .rdl files. For me, the image wizard does not come up for .rdlc files. Does anyone know why this is?

|||

I've noticed this too. That's what prompted my original question. So basically, here is what I've figured out.

1. Click on Reports > Embedded Images.

2. Add your new image, remember what you named it.

3. Add an image to your report.

4. Click on the image.

5. Change the Source property to 'Embedded'

6. Change the value property to the name of your embedded image.

That's it! I'm still not sure why the wizard doesn't work.

Embedding PDF Document

Does reporting services allow emdedding of PDF documents? I dont want to convert the document to JPEG as the size increases many times (for me the image size is around 1.6MB vs. 100KB for PDF) and i have several of these images. Would appreciate if anyone has done similar exercise to embed document within reports.
thanks !!Not sure what we would really embed it in? HTML isn't really a format that
supports embedding. You can embed docs in e-mail messages as well as link to
docs on a web page. I suppose we could have an MHTML format that embedded a
PDF file but this hasn't been high on the priority list.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ashok Jain" <Ashok Jain@.discussions.microsoft.com> wrote in message
news:0D468114-DF97-4800-ADB8-411D1C362954@.microsoft.com...
> Does reporting services allow emdedding of PDF documents? I dont want to
> convert the document to JPEG as the size increases many times (for me the
> image size is around 1.6MB vs. 100KB for PDF) and i have several of these
> images. Would appreciate if anyone has done similar exercise to embed
> document within reports.
> thanks !!|||But where is the PDF document stored? You can't 'embed' documents in a web
page. Can you just link to the document on a web site from the report? You
could even store the PDF in the Report Server database and link to it.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ashok Jain" <AshokJain@.discussions.microsoft.com> wrote in message
news:111C7F98-B8FF-4F7A-AF74-E14F9EE1650E@.microsoft.com...
> Thanks Brian !
> The issue I have is that I need to embed pre-generated PDF documents into
> the report and I am not sure how can I do that unless I convert the PDF
> into JPEG and then use the IMAGE control to embed. This works fine -
> however the size increase makes the report useless. For example, a 100KB
> PDF becomes 1.6MB JPEG file and you can imagine the generate and print
> pains if I have 10-20 of those images.
> Would love to have the feature where PDF or WORD docs can be imported into
> report pages -- is there an alternative like may be using a 3rd party
> activex or something like that?
> thanks again,
> Ashok
>
>
> "Brian Welcker [MSFT]" wrote:
>> Not sure what we would really embed it in? HTML isn't really a format
>> that
>> supports embedding. You can embed docs in e-mail messages as well as link
>> to
>> docs on a web page. I suppose we could have an MHTML format that embedded
>> a
>> PDF file but this hasn't been high on the priority list.
>> --
>> Brian Welcker
>> Group Program Manager
>> SQL Server Reporting Services
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "Ashok Jain" <Ashok Jain@.discussions.microsoft.com> wrote in message
>> news:0D468114-DF97-4800-ADB8-411D1C362954@.microsoft.com...
>> > Does reporting services allow emdedding of PDF documents? I dont want
>> > to
>> > convert the document to JPEG as the size increases many times (for me
>> > the
>> > image size is around 1.6MB vs. 100KB for PDF) and i have several of
>> > these
>> > images. Would appreciate if anyone has done similar exercise to embed
>> > document within reports.
>> >
>> > thanks !!
>>

Embedding multiple .sql files

How do I write a .sql script that executes a number of other scripts in .sql
files? This has to be easy. I just can't find it.
Thanks,
JerryRYou can use oSql. See if this helps:
http://www.sql-server-performance.com/rd_osql.asp
Andrew J. Kelly SQL MVP
"JerryR" <JerryR@.discussions.microsoft.com> wrote in message
news:76549937-4F1E-41B5-B148-A548F0B8CA95@.microsoft.com...
> How do I write a .sql script that executes a number of other scripts in
> .sql
> files? This has to be easy. I just can't find it.
> Thanks,
> JerryR|||There is no such feature in SQL like this in Oracle @.Somefile.sql. You
have to put in in a OS batch to execute it via a cmdshell program like
SQLCMD or OSQL or ISQL.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--|||Yes, that's what I was looking for.
Thanks
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1143927815.456011.236990@.v46g2000cwv.googlegroups.com...
> There is no such feature in SQL like this in Oracle @.Somefile.sql. You
> have to put in in a OS batch to execute it via a cmdshell program like
> SQLCMD or OSQL or ISQL.
>
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>

Embedding literals in RDL that will come through in HTML

I am trying to create some reports that when rendered in HTML are supposed to have some interactivity built into them. I understand that there aren't any facilities in RDL itself that would help facilitate this process for me, but is there any way to embed some literal strings that will come through in the HTML?

The items I'm trying to finesse through are <script> blocks, checkboxes, and <object> tags. When I use the designer to put these items into textboxes, they get encoded with the HTML values (&gt; instead of >, etc...) so that the code is displayed instead of interpreted.

I thought maybe there would be a VB function that I can wrap around the HTML to prevent it from being encoded so that when the report is displayed on the screen that the interactive elements are there.

Any ideas?

I think this relates to formatting text within a cell, which does not appear to be possible. Perhaps some sort of javascript which will change the innerHTML of the report document?|||

Thanks for the response.

I think that I have solved the problem for my situation. Here's what I've discovered so far:

If you use a textbox control, you can set the value of it to an HTML snippet (I'm using an object tag with some param tags as well as checkbox controls). When the report is rendered to HTML, the HTML that was embedded into the report shows as source on the page. I've taken that HTML, saved it off to a file and modified it using some .NET classes. Specifically the HTTPUtility.HtmlDecode function. That function will take the HTML file and undo all of the encoding that Reporting Services has done to your HTML. I also did a small test where I inserted a "&lt;" character somewhere else in the HTML document to simulate something that may actually occur. When I decoded the file that time, all of the encoded HTML snippets were properly decoded, and the less than sign was left alone.

If someone were rendering using the Web Service APIs for Reporting Services, this would work because you are given the stream back. In the case of using a WebForms ReportViewer though, it might be more difficult.

I hope this helps anyone who has a similar problem.

|||Sounds interesting, can you post the code or a snippet of it?
This may help MS to build as a feature in the next SP as this seems like a pretty common thing (how do I embed html/change style within a text box)|||

Hi Ken,

i'm new with sql reporting service, may i know anyway to make my report export with html format and allow me to send to customer using the ms outlook?

my report contain chart and also table, and image.

i did trying to export using mhtml, but after i send it using the email. at my desktop i able to see it. but my manager not able to read all the image and chart.

thanks for your help.

|||

Hello,

Can you please share the code or detail the approach you have taken?

Thanks

Embedding literals in RDL that will come through in HTML

I am trying to create some reports that when rendered in HTML are supposed to have some interactivity built into them. I understand that there aren't any facilities in RDL itself that would help facilitate this process for me, but is there any way to embed some literal strings that will come through in the HTML?

The items I'm trying to finesse through are <script> blocks, checkboxes, and <object> tags. When I use the designer to put these items into textboxes, they get encoded with the HTML values (&gt; instead of >, etc...) so that the code is displayed instead of interpreted.

I thought maybe there would be a VB function that I can wrap around the HTML to prevent it from being encoded so that when the report is displayed on the screen that the interactive elements are there.

Any ideas?

I think this relates to formatting text within a cell, which does not appear to be possible. Perhaps some sort of javascript which will change the innerHTML of the report document?|||

Thanks for the response.

I think that I have solved the problem for my situation. Here's what I've discovered so far:

If you use a textbox control, you can set the value of it to an HTML snippet (I'm using an object tag with some param tags as well as checkbox controls). When the report is rendered to HTML, the HTML that was embedded into the report shows as source on the page. I've taken that HTML, saved it off to a file and modified it using some .NET classes. Specifically the HTTPUtility.HtmlDecode function. That function will take the HTML file and undo all of the encoding that Reporting Services has done to your HTML. I also did a small test where I inserted a "&lt;" character somewhere else in the HTML document to simulate something that may actually occur. When I decoded the file that time, all of the encoded HTML snippets were properly decoded, and the less than sign was left alone.

If someone were rendering using the Web Service APIs for Reporting Services, this would work because you are given the stream back. In the case of using a WebForms ReportViewer though, it might be more difficult.

I hope this helps anyone who has a similar problem.

|||Sounds interesting, can you post the code or a snippet of it?
This may help MS to build as a feature in the next SP as this seems like a pretty common thing (how do I embed html/change style within a text box)|||

Hi Ken,

i'm new with sql reporting service, may i know anyway to make my report export with html format and allow me to send to customer using the ms outlook?

my report contain chart and also table, and image.

i did trying to export using mhtml, but after i send it using the email. at my desktop i able to see it. but my manager not able to read all the image and chart.

thanks for your help.

|||

Hello,

Can you please share the code or detail the approach you have taken?

Thanks

sql

Embedding literals in RDL that will come through in HTML

I am trying to create some reports that when rendered in HTML are supposed to have some interactivity built into them. I understand that there aren't any facilities in RDL itself that would help facilitate this process for me, but is there any way to embed some literal strings that will come through in the HTML?

The items I'm trying to finesse through are <script> blocks, checkboxes, and <object> tags. When I use the designer to put these items into textboxes, they get encoded with the HTML values (&gt; instead of >, etc...) so that the code is displayed instead of interpreted.

I thought maybe there would be a VB function that I can wrap around the HTML to prevent it from being encoded so that when the report is displayed on the screen that the interactive elements are there.

Any ideas?

I think this relates to formatting text within a cell, which does not appear to be possible. Perhaps some sort of javascript which will change the innerHTML of the report document?|||

Thanks for the response.

I think that I have solved the problem for my situation. Here's what I've discovered so far:

If you use a textbox control, you can set the value of it to an HTML snippet (I'm using an object tag with some param tags as well as checkbox controls). When the report is rendered to HTML, the HTML that was embedded into the report shows as source on the page. I've taken that HTML, saved it off to a file and modified it using some .NET classes. Specifically the HTTPUtility.HtmlDecode function. That function will take the HTML file and undo all of the encoding that Reporting Services has done to your HTML. I also did a small test where I inserted a "&lt;" character somewhere else in the HTML document to simulate something that may actually occur. When I decoded the file that time, all of the encoded HTML snippets were properly decoded, and the less than sign was left alone.

If someone were rendering using the Web Service APIs for Reporting Services, this would work because you are given the stream back. In the case of using a WebForms ReportViewer though, it might be more difficult.

I hope this helps anyone who has a similar problem.

|||Sounds interesting, can you post the code or a snippet of it?
This may help MS to build as a feature in the next SP as this seems like a pretty common thing (how do I embed html/change style within a text box)|||

Hi Ken,

i'm new with sql reporting service, may i know anyway to make my report export with html format and allow me to send to customer using the ms outlook?

my report contain chart and also table, and image.

i did trying to export using mhtml, but after i send it using the email. at my desktop i able to see it. but my manager not able to read all the image and chart.

thanks for your help.

|||

Hello,

Can you please share the code or detail the approach you have taken?

Thanks

Embedding isolation level in SQL OLE DB connection string?

Is there any way to embed the desired connection isolation level in a SQL
OLE DB connection string? I saw that the property "Isolation Level" exists
on SQL OLE DB connections but couldn't find a way to get this into the
connection string (extended property didn't work)
For 3rd party products that take connection strings and SQL queries and run
with them, it would be handy to be able to control the isolation level in
the connection string. I can do it at the SQL level, but I want the
isolation level to be configurable and not have to parse out/re-write the
SQL based upon the configured isolation level.
Thanks,
Mike
Mike Jansen wrote:
> Is there any way to embed the desired connection isolation level in a
> SQL OLE DB connection string? I saw that the property "Isolation
> Level" exists on SQL OLE DB connections but couldn't find a way to
> get this into the connection string (extended property didn't work)
> For 3rd party products that take connection strings and SQL queries
> and run with them, it would be handy to be able to control the
> isolation level in the connection string. I can do it at the SQL
> level, but I want the isolation level to be configurable and not have
> to parse out/re-write the SQL based upon the configured isolation
> level.
> Thanks,
> Mike
You can change the isolation level from the default of READ COMMITTED to
any of the other supported levels by issuing a single SQL statement
after you connect and it will stay in effect for the life of the
connection.
SET TRANSACTION ISOLATION LEVEL
{ READ COMMITTED
| READ UNCOMMITTED
| REPEATABLE READ
| SERIALIZABLE
}
David Gugick - SQL Server MVP
Quest Software

Embedding HTML in a Report

Does anyone know of a time frame on when SQL 2005 Reporting Services
will be able to handle the embedding of HTML into a report? I saw on
an old post that it is was supposed to be released in a follow on SP.
Does anyone have suggestions in displaying HTML into a field in a
report beyond converting it to an image first?On Apr 18, 4:17 pm, cara...@.gmail.com wrote:
> Does anyone know of a time frame on when SQL 2005 Reporting Services
> will be able to handle the embedding of HTML into a report? I saw on
> an old post that it is was supposed to be released in a follow on SP.
> Does anyone have suggestions in displaying HTML into a field in a
> report beyond converting it to an image first?
In terms of the time frame, I'm not sure; however, you could try a
workaround of using the Jump to URL property of a report control.
Sorry I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultant|||On Apr 19, 6:50 am, EMartinez <emartinez...@.gmail.com> wrote:
> On Apr 18, 4:17 pm, cara...@.gmail.com wrote:
> > Does anyone know of a time frame on whenSQL2005 Reporting Services
> > will be able to handle theembeddingofHTMLinto areport? I saw on
> > an old post that it is was supposed to be released in a follow on SP.
> > Does anyone have suggestions in displayingHTMLinto a field in a
> >reportbeyond converting it to an image first?
> In terms of the time frame, I'm not sure; however, you could try a
> workaround of using the Jump to URL property of areportcontrol.
> Sorry I could not be of greater assistance.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
Where can I find how to do that "Jump to URL" work around?|||On Apr 19, 8:01 am, Mike512 <mmahon...@.gmail.com> wrote:
> On Apr 19, 6:50 am, EMartinez <emartinez...@.gmail.com> wrote:
>
> > On Apr 18, 4:17 pm, cara...@.gmail.com wrote:
> > > Does anyone know of a time frame on whenSQL2005 Reporting Services
> > > will be able to handle theembeddingofHTMLinto areport? I saw on
> > > an old post that it is was supposed to be released in a follow on SP.
> > > Does anyone have suggestions in displayingHTMLinto a field in a
> > >reportbeyond converting it to an image first?
> > In terms of the time frame, I'm not sure; however, you could try a
> > workaround of using the Jump to URL property of areportcontrol.
> > Sorry I could not be of greater assistance.
> > Regards,
> > Enrique Martinez
> > Sr. Software Consultant
> Where can I find how to do that "Jump to URL" work around?
First you will want to deploy the HTML file to the webserver/IIS so
that a hyperlink can access it.
Then, depending on how you want to do it, add a report control (table/
image/textbox) to the report in Layout view, select the Properties
(via right-click), select the Navigation tab, and below 'Hyperlink
action:' select Jump to URL and enter in the URL of the newly deployed
HTML file (i.e., http://localhost/SomeVirtualDirectoryName/HTMLFileName.html).
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||One other option is to have dotnet code (behind report or an assembly) that
strips the html control characters from the text.
I haven't done this but I know that people have done this.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Mike512" <mmahon512@.gmail.com> wrote in message
news:1176987680.073062.65410@.d57g2000hsg.googlegroups.com...
> On Apr 19, 6:50 am, EMartinez <emartinez...@.gmail.com> wrote:
>> On Apr 18, 4:17 pm, cara...@.gmail.com wrote:
>> > Does anyone know of a time frame on whenSQL2005 Reporting Services
>> > will be able to handle theembeddingofHTMLinto areport? I saw on
>> > an old post that it is was supposed to be released in a follow on SP.
>> > Does anyone have suggestions in displayingHTMLinto a field in a
>> >reportbeyond converting it to an image first?
>> In terms of the time frame, I'm not sure; however, you could try a
>> workaround of using the Jump to URL property of areportcontrol.
>> Sorry I could not be of greater assistance.
>> Regards,
>> Enrique Martinez
>> Sr. Software Consultant
> Where can I find how to do that "Jump to URL" work around?
>|||Thanks for the reply. At first I was trying to retain the HTML in the report
then I just decided to scrap it. So I did that by adding this function:
This was taken from this guy and convert to VB:
http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx
To call the function in the Expression Editor of the textbox just use:
=Code.StripHTML(Fields!<whateverfieldyouwanttostriphtmlfrom>.Value)
I hope this helps someone just trying to strip the HTML out since MS hasn't
hacked out a friggin control to render it.
Cheers,
Mike
"EMartinez" wrote:
> On Apr 19, 8:01 am, Mike512 <mmahon...@.gmail.com> wrote:
> > On Apr 19, 6:50 am, EMartinez <emartinez...@.gmail.com> wrote:
> >
> >
> >
> > > On Apr 18, 4:17 pm, cara...@.gmail.com wrote:
> >
> > > > Does anyone know of a time frame on whenSQL2005 Reporting Services
> > > > will be able to handle theembeddingofHTMLinto areport? I saw on
> > > > an old post that it is was supposed to be released in a follow on SP.
> > > > Does anyone have suggestions in displayingHTMLinto a field in a
> > > >reportbeyond converting it to an image first?
> >
> > > In terms of the time frame, I'm not sure; however, you could try a
> > > workaround of using the Jump to URL property of areportcontrol.
> > > Sorry I could not be of greater assistance.
> >
> > > Regards,
> >
> > > Enrique Martinez
> > > Sr. Software Consultant
> >
> > Where can I find how to do that "Jump to URL" work around?
> First you will want to deploy the HTML file to the webserver/IIS so
> that a hyperlink can access it.
> Then, depending on how you want to do it, add a report control (table/
> image/textbox) to the report in Layout view, select the Properties
> (via right-click), select the Navigation tab, and below 'Hyperlink
> action:' select Jump to URL and enter in the URL of the newly deployed
> HTML file (i.e., http://localhost/SomeVirtualDirectoryName/HTMLFileName.html).
> Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>|||> Does anyone have suggestions in displaying HTML into a field in a
> report beyond converting it to an image first?
Yes, I do. But I'm going to start sounding like a broken record <g>.
You can do this by taking the XML output and applying an XSLT to it! It's
really up to you to decide how the HTML output looks, not what they decided
to provide as an HTML presentation.
The catch here would be how you wanted to display that report in other
formats, such as PDF. You can write XSLT to go to (say) rich text or post
script or use XSL:FO.
But you're still going to have to manage the impedance mismatch between the
HTML formatting you're trying to reproduce and these other formats. That's
why "converting to an image" makes sense to a lot of people -- it's not the
HTML display that's the problem, it's the multiple output targets that have
to render that HTML field.
HTML, almost by definition, mixes formatting and content. That's why it's a
PITA for any reporting engine with multiple output targets. You have to
separate the two and then translate the formatting so you can apply it to
the content as appropriate to the current target.
>L<
<caragav@.gmail.com> wrote in message
news:1176931060.300151.199480@.y5g2000hsa.googlegroups.com...
> Does anyone know of a time frame on when SQL 2005 Reporting Services
> will be able to handle the embedding of HTML into a report? I saw on
> an old post that it is was supposed to be released in a follow on SP.
> Does anyone have suggestions in displaying HTML into a field in a
> report beyond converting it to an image first?
>

embedding html

Just curious if anyone has any hints to embed HTML directly into a report. I
am doing reports that will be exported to excel when run as a subscription
and using an index (which jump to bookmarks) and page breaks to get each
report onto new tabs.
My current report, done with a different tool, has 2 "Help" tabs that are
formatted text that describe how to interpret the report. I need to
replicate this in reporting services. One problem is that textbox in RS is
way too limited in its functionality.
I could probably link out to an HTML page, but I want the new help tabs to
export to excel along with the report.
Any ideas?I can't think of a way until HTML is supported in text boxes.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"asnewbie+rs=argh" <asnewbiersargh@.discussions.microsoft.com> wrote in
message news:DDC6A10A-32BE-43BE-9296-F2B64769DEAA@.microsoft.com...
> Just curious if anyone has any hints to embed HTML directly into a report.
> I
> am doing reports that will be exported to excel when run as a subscription
> and using an index (which jump to bookmarks) and page breaks to get each
> report onto new tabs.
> My current report, done with a different tool, has 2 "Help" tabs that are
> formatted text that describe how to interpret the report. I need to
> replicate this in reporting services. One problem is that textbox in RS
> is
> way too limited in its functionality.
> I could probably link out to an HTML page, but I want the new help tabs to
> export to excel along with the report.
> Any ideas?

Embedding Fonts While Exporting To PDF

Hi,
My report requires a special type of font. I have the font installed on the
report server. When I export the report as PDF and view the document on the
report server I am able to see the new font. But when I open the same
document on a machine which doesn't have the font installed, I don't get to
see the font. I understand that there is some way you can configure your pdfs
so that the fonts are embedded within the PDF so that all the clients need
not have the font installed to view the document. Is there any way we can
embed fonts in pdfs using reporting services?
Any help is greatly appreciated.
Thanks,
GeorgeYou can't embed fonts into PDF exports in this version of SRS. Maybe next
version which is due maybe middle of next year. Crystal Reports allows you
to embed fonts in version 9.
"george" wrote:
> Hi,
> My report requires a special type of font. I have the font installed on the
> report server. When I export the report as PDF and view the document on the
> report server I am able to see the new font. But when I open the same
> document on a machine which doesn't have the font installed, I don't get to
> see the font. I understand that there is some way you can configure your pdfs
> so that the fonts are embedded within the PDF so that all the clients need
> not have the font installed to view the document. Is there any way we can
> embed fonts in pdfs using reporting services?
> Any help is greatly appreciated.
> Thanks,
> Georgesql

Embedding Dundas Chart Pro Charts in RS

This there a way to integrate the full version of Dundas Chart Pro in RS reports by using the extensibility API?
Including a URL accessed image of a Dundas Chart doesn't cut it if the rendering is to be done by PDF - my experence is showing that the image will be heavily pixelated.
TIA
JeffNot yet. I expect the Yukon version to support extensibility.
see www.sqlreportingservices.net
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"jbarts" <jbarts@.discussions.microsoft.com> wrote in message
news:A41DEF90-1E42-4C54-9C42-6191E08BA533@.microsoft.com...
> This there a way to integrate the full version of Dundas Chart Pro in RS
reports by using the extensibility API?
> Including a URL accessed image of a Dundas Chart doesn't cut it if the
rendering is to be done by PDF - my experence is showing that the image will
be heavily pixelated.
> TIA
> Jeff

embedding ASPNETDB into my own db

Hi there,

i wanted to embed ASPNETDB into my own db, so i scripted the ASPNETDB and executed it into my db. the problem is that App Manager of my website can not connect to it,(>i've corrected the connectionstring LocalSqlServer), the problem is that, it says its schema is not as expected, i understand this problem but, is there any way to solve it?

thanks in advance

Hi,

Since you're scripting the ASPNETDB to move it to your own db, I suggest you check if there is anything missing. Because you might not scripting everything.

However, I suggest you seperate the ASPNETDB from your own db, since you might need to perform some configuration on the ASPNETDB using .NET tools, which might affect the whole database.

|||

Hi,

well, as an inverse approach, i embedded (scripted) my own db into ASPNETDB, and it now works. it seems, as you said, i hadn't copied everything, although i had checked the 'copy all objects' choice.

thanks

Embedding an object into report

Hi,

I am trying to figure out the way to embed a plug-in (Chime for Windows)
into my report, so that I can display a certain object from a database, that
is stored there as a string. This Chime plug-in would read the input string
and convert it to video display.
This embedding is easily done in simple HTML:
<embed type='chemical/x-mdl-molfile' display2d=true width=200 height=200
hlabels2d='terminalhetero' structure= [encrypted string from the database
follows]>

I am wondering is there a way to do such embedding straight into my report
by using the report designer features or by modifying an RDL file for my
report?
If I am able to place my <embed...> string somewhere in my report and when the report is rendered as HTML this string is interpreted as an HTML tag, this would be awesome! So far I experimented with displaying <embed...> string in one of my textboxes, but HTML renderer for report obviously interprets my string as a text not as a tag, so instead of seeing plug-in in action I just see the text of my string.

Probably another approach would be to embed an HTML in a report.
That would also be an exiting idea.
I would appreciate any help on this.
Thanks in advance!
Anton.Reporting Services does not support embedded HTML or object tags. The only way you could do this is to post-process the resulting output.|||

Hello,

Can you detail the approach to be taken, please?

Thanks

Embedding an object into report

Hi,

I am trying to figure out the way to embed a plug-in (Chime for Windows)
into my report, so that I can display a certain object from a database, that
is stored there as a string. This Chime plug-in would read the input string
and convert it to video display.
This embedding is easily done in simple HTML:
<embed type='chemical/x-mdl-molfile' display2d=true width=200 height=200
hlabels2d='terminalhetero' structure= [encrypted string from the database
follows]>

I am wondering is there a way to do such embedding straight into my report
by using the report designer features or by modifying an RDL file for my
report?
If I am able to place my <embed...> string somewhere in my report and when the report is rendered as HTML this string is interpreted as an HTML tag, this would be awesome! So far I experimented with displaying <embed...> string in one of my textboxes, but HTML renderer for report obviously interprets my string as a text not as a tag, so instead of seeing plug-in in action I just see the text of my string.

Probably another approach would be to embed an HTML in a report.
That would also be an exiting idea.
I would appreciate any help on this.
Thanks in advance!
Anton.Reporting Services does not support embedded HTML or object tags. The only way you could do this is to post-process the resulting output.|||

Hello,

Can you detail the approach to be taken, please?

Thanks

Embedding a reporting Services object

Hi,
Can I embedde a reporting services object in my web based application so the
clients can use the reporting seemlessly.
Thanks in advance,
BenjaminYes, you can. Take a look at the ReportViewer sample that Microsoft
includes.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"BenJ" <BenJ@.netvu.com> wrote in message
news:O3XVHB4HFHA.2456@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Can I embedde a reporting services object in my web based application so
> the
> clients can use the reporting seemlessly.
> Thanks in advance,
> Benjamin
>|||Check this example
http://www.rdlcomponents.com/ASPExamples/default.aspx
"Jeff A. Stucker" wrote:
> Yes, you can. Take a look at the ReportViewer sample that Microsoft
> includes.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "BenJ" <BenJ@.netvu.com> wrote in message
> news:O3XVHB4HFHA.2456@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > Can I embedde a reporting services object in my web based application so
> > the
> > clients can use the reporting seemlessly.
> >
> > Thanks in advance,
> > Benjamin
> >
> >
>
>

Embedding a Report Within Page

Ok, I am getting extremely frustrated here, so I hope someone can help me.

I am trying to pass a parameter to a reportviewer control that is supposed to run a server report. This is how I am doing this:

Dim serverParams(0) As ReportParameter
serverParams(0) = New ReportParameter("RMAID", "3")
Me.RMAReport.ServerReport.ReportServerUrl = New Uri("http://MEDUSA/reportserver")
Me.RMAReport.ServerReport.ReportPath = "/CustomerServiceReports/RMAListingsById"
Me.RMAReport.ServerReport.SetParameters(serverParams)
Me.RMAReport.ServerReport.Refresh()


Now as far as I can tell this should work, but no matter what I do I get

Execution '' Cannot Be Found

Then I can not run any of the server reports at all, not just this one. Going to the reportserver I can run this report just fine. I just can't seem to get it so that this will render. Could someone please help me, I am about to go nuts!!!!

Thank you,

Josh

Ok, so I solved this problem by going from remote processing to local processing...I now have ran into another issue...I'll copy from my post over at the sql server 2005 forums where i have yet to receive a response....

Ok, I have been struggling with getting a report to run that I can pass parameters to for two days now, I have finally made progress on that front from going to local processing vs remote processing.

Now though I am about to pitch my computer underneath a truck if I don't get this solved shortly. I have two subreports as a part of this report. They aresupposedto be passed the id value as a parameter from the parent report. I found out that I still have to set data sources for these sub reports, so I attached the subreportprocessing event to the report viewer and attached the datasources that I created. My problem, I assume, is I don't understand how the dataset is supposed to be defined. I have tried three different ways. I built one dataset that has the relations to the two different tables that the sub reports use and built 3 distinct object data sources that reference the appropriate table adapters in the single dataset and I run the report.

Result I get every record in both tables for each record in the parent report

So next I tried creating three distinct datasets referencing the individual tables that the three reports would use (1 parent 2 child) and assign the datasources to the table adapters for the relevant reports and assigned them in the event.

Result I get every record in both tables for each record in the parent report

Finally I change the dataset to use a parameter to filter out the rows to only be the one for the relevant record in the report. I use the exact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event

Result I get no error but I get no data either. I am assuming because it is not getting a parameter value.

I can find almost no information on this at all...I'm bashing my head on my desk yelling "WHY?"....this should not be this hard...please someone advise me in the proper direction. If you need any source samples please let me know....

|||

Does anyone have any ideas? I am running out of time to figure this out?

Thank you,

Josh

|||

Hello there:

In case you didn't play this drillthrough sample on:

http://www.gotreportviewer.com/

I am fighting for different issues with this reportviewer. It takes to long to figure out things that is supposed to be documented.

Good luck.

|||

I have spent a lot of time on that site, but it doesn't seem to have what I need.

Unfortunately I am not using drillthrough reports but just two sub reports...I implemented their sub reports exactly as they did except with sql instead of xml, but like I noted I return all results rather than the filtered results.

This truly should not be this hard....I have never wanted to go back to crystal reports until now....this is truly hurting my deadline...

Josh

|||

The reportviewer control is really meant to be used with local reports. Probably if you switched over to fully using the the report server or the reportviewer with local reports, you'll eliminate many of your difficulties.

|||

Hello again:

I look at the sample for the subreport and I found the way you assigned the parameter was different from the sample.

"Finally I change the dataset to use a parameter to filter out the rowsto only be the one for the relevant record in the report. I use theexact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event"

Actually, you can assign the parameter through the property of the subreport: right click on your subreport> subreport Properties>Parameters: under this tab, you assign your parameter name and value. For example, mainID-- Field!mainID.Value.

I have read tons to find more about this control. I don't know whether this can fix your problem.

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
Height="100%" Width="100%" AsyncRendering="False" SizeToReportContent="True">
<LocalReport ReportPath="YourMainReport.rdlc" OnSubreportProcessing="ReportViewer1_SubreportProcessing">
</LocalReport>
</rsweb:ReportViewer>

I think in OnSubreportProcessing you simply assign your subreport dataset to datasource. Another thing is to make sure the name of these datasets: yourDataset_yourDatatable. They have to be consistent with the definition in the source of your .rdlc files. You can check them to make sure.

I am close to get what I want to implement. I hope I can share with you with my findings.

|||

Limno,

You are right, I was doing it incorrectly. I solved my problem yesterday by a stroke of luck. You are right in the assumption that I was looking at the parameters incorrectly...I actually needed to pass all possible values to the sub report through the data source. I then needed to go in and make sure filtering was set up on the table that I was using to properly utilize the parameters passed to it. I wish this had been more clear in the documentation, or mentioned at all really, but it wasn't. Anyways, thank you for all of your help and if there is anything I can help with in your problem, please let me know!

Thanks,

Josh

embedding a DTS package which contains a 'Copy SQL Server Objects Task'

Hi,

I am getting an error when doing the above.

I create a new SSIS package, drag in an Execute DTS 2000 Package Task, select and embed a DTS package which consists only one one task (as above), and then change the source & destination details (svr + user/pwd). Then when I go to the Copy tab, I get the following error when I hit Select Objects, to view the objects which the embedded DTS package should copy:

SQL-DMO error 21776: general error.

On further inspection, none of the objects selected for copy within the atomic/original DTS package, remain selected for copy within the embedded DTS package.

I have googled to search for an answer to this one, but to no avail. Any ideas would be greatly welcomed.

Thanks,

Tamim.

Off the top of my head I am not sure...but I wonder if there is more to this or perhaps what the real goal is?

I ask because if your only dealing with one transfer task from a dts package, then why not just create a new SSIS package using the new ssis transfer tasks? Prehaps you have 100s of said DTS packages, and you need to keep them going rather than rebuild all. However, we should always keep in mind that while the Execute DTS 2000 Package Task is nice for 'keeping things running' from the old version, over time you will want to rebuild any DTS pacakge as a 'native' SSIS 2005 pacakge allows you to do a lot more AND DTS is considered a deprecated technology, which does mean its fading form the picure. If you want you can read more about that here.

http://msdn2.microsoft.com/en-us/library/ms403408.aspx

Hope that helps.

|||

'...if your only dealing with one transfer task from a dts package, then why not just create a new SSIS package using the new ssis transfer tasks?...'

Sure. And that's exactly what I did, thus reducing the problem to being merely academic - but it's still there....

Thanks Craig,

embedding a DTS package and logging/error reporting

Hi All,

When the embedded DTS package fails at runtime, and logging has been enabled for the package (and all log events selected for reporting on for the package and the task), the DTS error (i.e. any meaningful errors) are not thrown up to/caught by the SSIS/outer level. All you get is something like:

COMException - error returned from a call to a COM component.

Does anyone have any comments &/or know to get errors thrown from within an embedded DTS package, thrown up to the wrapping SSIS package?

Cheers,

Tamim.

Hi Tamim,

Try configuring your DTS package (using the old SQL 2000 designer) to log to an msdb database (it can be a SQL 2005 msdb). Then you will find the DTS messages logged to the tables eg sysdtspackagelog and sysdtssteplog.

Good luck.

Mike

embedding a DTS package and logging/error reporting

Hi All,

When the embedded DTS package fails at runtime, and logging has been enabled for the package (and all log events selected for reporting on for the package and the task), the DTS error (i.e. any meaningful errors) are not thrown up to/caught by the SSIS/outer level. All you get is something like:

COMException - error returned from a call to a COM component.

Does anyone have any comments &/or know to get errors thrown from within an embedded DTS package, thrown up to the wrapping SSIS package?

Cheers,

Tamim.

Hi Tamim,

Try configuring your DTS package (using the old SQL 2000 designer) to log to an msdb database (it can be a SQL 2005 msdb). Then you will find the DTS messages logged to the tables eg sysdtspackagelog and sysdtssteplog.

Good luck.

Mike

sql

Embedded Word Document in RDL

I have a word document that I would to migrate to reporting services
2005. Instead of recreating the word document in reporting services, I
would like to know if I can embed the word document in a report? If
not, what other options are there?
Thanks.If you would like the word document to be hosted by RS then in your project
add a new existing item and then select your Word file. Then you can deploy
it. Note that when you update it and want to redeploy I have found that I
have to delete it from the report server first prior to deployment.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"TCogan" <tcogan@.starcon.org> wrote in message
news:1174500858.861820.168170@.y66g2000hsf.googlegroups.com...
>I have a word document that I would to migrate to reporting services
> 2005. Instead of recreating the word document in reporting services, I
> would like to know if I can embed the word document in a report? If
> not, what other options are there?
> Thanks.
>|||On Mar 21, 1:45 pm, "Bruce L-C [MVP]" <bruce_lcNOS...@.hotmail.com>
wrote:
> If you would like the word document to be hosted by RS then in your project
> add a new existing item and then select your Word file. Then you can deploy
> it. Note that when you update it and want to redeploy I have found that I
> have to delete it from the report server first prior to deployment.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "TCogan" <tco...@.starcon.org> wrote in message
> news:1174500858.861820.168170@.y66g2000hsf.googlegroups.com...
>
> >I have a word document that I would to migrate to reporting services
> > 2005. Instead of recreating the word document in reporting services, I
> > would like to know if I can embed the word document in a report? If
> > not, what other options are there?
> > Thanks.- Hide quoted text -
> - Show quoted text -
I have tried that and that does work. But I was trying to find the
best way to migrate the word document into an RDL file. I want it to
be an RDL file because I have some other data that I want to
incorporate into the report from a database. I am not sure this can
be done, but I would like to avoid from having to recreate the word
document in an RDL file.|||There might be a third party tool that allows this but not straight out of
the box.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"TCogan" <tcogan@.starcon.org> wrote in message
news:1174503465.010122.233220@.p15g2000hsd.googlegroups.com...
> On Mar 21, 1:45 pm, "Bruce L-C [MVP]" <bruce_lcNOS...@.hotmail.com>
> wrote:
>> If you would like the word document to be hosted by RS then in your
>> project
>> add a new existing item and then select your Word file. Then you can
>> deploy
>> it. Note that when you update it and want to redeploy I have found that I
>> have to delete it from the report server first prior to deployment.
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "TCogan" <tco...@.starcon.org> wrote in message
>> news:1174500858.861820.168170@.y66g2000hsf.googlegroups.com...
>>
>> >I have a word document that I would to migrate to reporting services
>> > 2005. Instead of recreating the word document in reporting services, I
>> > would like to know if I can embed the word document in a report? If
>> > not, what other options are there?
>> > Thanks.- Hide quoted text -
>> - Show quoted text -
> I have tried that and that does work. But I was trying to find the
> best way to migrate the word document into an RDL file. I want it to
> be an RDL file because I have some other data that I want to
> incorporate into the report from a database. I am not sure this can
> be done, but I would like to avoid from having to recreate the word
> document in an RDL file.
>

Embedded Video?

Hey everyone,

Is there any way to embed a video in a report? It doesn't seem like it but I thought I may be missing something. Maybe directly editing the xml code? Thanks.

-Keith

You may want to look at Sharepoint & possibly PerformancePoint rather than just Reporting Services. You could display the report and display a video in a separate webpart.

I am curious what the video requirement is for.

I don't believe there is a way to embed video - only to link to a page containing the video, or display outside of the report.

There is a way to create a custom control and bring it into Reporting Services, however I think this just renders html & images.

cheers,

Andrew

Embedded VB.NET Code Limitations?

What are the limitations to using the Embedded VB.NET Code within a RDL?
Is it possible to control the IE Browser features via the Embedded Code?
JeffThere are no syntax limitations in VB code used in report expressions and
Code element. You can also call custom assemblies that must only be managed
but could be writting in VB, C# or even managed C++, etc...
If I correctly understand your question you want to write a code hosted
inside a report that will run on client and control browser via ActiveX
interface. This is not possible because all code inside report is always
executed on server and never passed back to the client for execution.
RS also does not support embedding scripts into HTML output. If it was
allowed it would be a security hole...
You can write your own application that will host IE Browser control and
will talk to report server to retrieve reports.
"Jeff" <Jeff@.discussions.microsoft.com> wrote in message
news:C762FC98-66B6-4358-9E91-28F2B3129475@.microsoft.com...
> What are the limitations to using the Embedded VB.NET Code within a RDL?
> Is it possible to control the IE Browser features via the Embedded Code?
> Jeff

Embedded Text Qualifiers no longer supported in Yukon ?

Hello,
I try to import the data below from a text file using the SQL Server 2005
import wizard with a "Flat File Source" and receive the error "SQL Server
Import and Export Wizard / The preview sample contains embedded text
qualifiers ("). The flat file parser does not support embedding text
qualifiers in data. Parsing columns that contain data with text qualifiers
will fail at run time."
With SQL Server 2000 this was no problem. The files I want to import are
about 100MB in size. Any workaround?
select @.@.version returns: Microsoft SQL Server 2005 - 9.00.1314.06 (X64)
Sep 2 2005 21:10:23 Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 1)
Sample data:
1 inch,"2""","3 inches","4, 5, and 6""",7 inches,"8"", 9"",""10""""",11
inches
Kind regards,
Frank
Hi Frank...

Found your post here:
http://www.eggheadcafe.com/forumarchives/sqlserverdts/oct2005/post24522404.asp

Any progress in the concerning topic?

Embedded Text Qualifiers no longer supported in Yukon ?

Hello,
I try to import the data below from a text file using the SQL Server 2005
import wizard with a "Flat File Source" and receive the error "SQL Server
Import and Export Wizard / The preview sample contains embedded text
qualifiers ("). The flat file parser does not support embedding text
qualifiers in data. Parsing columns that contain data with text qualifiers
will fail at run time."
With SQL Server 2000 this was no problem. The files I want to import are
about 100MB in size. Any workaround?
select @.@.version returns: Microsoft SQL Server 2005 - 9.00.1314.06 (X64)
Sep 2 2005 21:10:23 Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 1)
Sample data:
1 inch,"2""","3 inches","4, 5, and 6""",7 inches,"8"", 9"",""10""""",11
inches
Kind regards,
Frank
Hi Frank...

Found your post here:
http://www.eggheadcafe.com/forumarchives/sqlserverdts/oct2005/post24522404.asp

Any progress in the concerning topic?
|||Check this:
http://www.microsoft.com/downloads/details.aspx?FamilyID=7952c866-807b-4715-80ba-498e0a16ab18&DisplayLang=ensql

Embedded text qualifiers

We have text files that are comma delimited, use double quotes as text qualifiers and sometimes have embedded double quotes. The embedded double quotes are escaped with an additional double quote like: below.

"123","product q"

"124","product ""a"""

DTS 2000 had no problem with this- it correctly parsed the files. The 2005 SSIS file connection manager correctly parses this in preview mode. But when the task is executed the task fails with the message "The column delimiter for column X was not found".

What is the recommended approach for this - we have alot of files in this format.

thanks

Please search the forums.

This should get you started: (in a sense, it's not going to be easy) http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=80634&SiteID=1|||I've had to do this as the other post with a script component. I import the whole row as a single column, then run via a regular expression a split command and then use replace function as well. Thats the best solution I have come across to your issue.|||Another workaround that I used successfully was to simply change the source file format. I changed it to |~| delimeter and no text qualifier. In addition I configured the SSIS source file connection manager to recognize the |~| as the delimiter and did not set the text qualifer option. In the end, it proved less painful than the other methods.

Embedded text qualifiers

We have text files that are comma delimited, use double quotes as text qualifiers and sometimes have embedded double quotes. The embedded double quotes are escaped with an additional double quote like: below.

"123","product q"

"124","product ""a"""

DTS 2000 had no problem with this- it correctly parsed the files. The 2005 SSIS file connection manager correctly parses this in preview mode. But when the task is executed the task fails with the message "The column delimiter for column X was not found".

What is the recommended approach for this - we have alot of files in this format.

thanks

Please search the forums.

This should get you started: (in a sense, it's not going to be easy) http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=80634&SiteID=1|||I've had to do this as the other post with a script component. I import the whole row as a single column, then run via a regular expression a split command and then use replace function as well. Thats the best solution I have come across to your issue.|||Another workaround that I used successfully was to simply change the source file format. I changed it to |~| delimeter and no text qualifier. In addition I configured the SSIS source file connection manager to recognize the |~| as the delimiter and did not set the text qualifer option. In the end, it proved less painful than the other methods.

Embedded tab Character

I have embedded tabs in a text field that I want to import to a destination table.

I was thinking I need to replace the tabs with spaces.

REPLACE(character_expression,searchstring,replacementstring) Anybody know how to specify ascii in the character expression.If there is a better way I am open to suggestions, however I do not way to remove this in the raw data but handle at transformation time. Thanks,LarryReplace ( fieldname, CHAR(10), ' ')|||

Thanks,

I beleive it is a char 9 , but I really wanted to change crlf Char(10) & CHAR(13).

Can I do this in one statement with the replace

Replace ( fieldname, CHAR(10) & CHAR(13), ' ')

Thanks,

Larry

|||

Regular expression work well to match and remove / replace string patterns.

To remove carriage return / new line combos, use a script component transform which replaces each occurrence of the pattern with an empty string.

To do so, drop a script component on the data flow canvas, selecting the desired column from the available input columns, and setting its usage type to Read/Write.

A regular expression is then used to match and remove the pattern.

Imports System
Imports

System.Data
Imports

System.Math
Imports

Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports

Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports

System.Text.RegularExpressions

Public Class ScriptMain
Inherits

UserComponent

Private

regex As Regex = New

Regex("\r\n",

RegexOptions.Compiled)

Public Overrides Sub

Input0_ProcessInputRow(ByVal Row As Input0Buffer)
If Not Row.GeneratedStr1_IsNull Then
Row.GeneratedStr1 =

regex.Replace(Row.GeneratedStr1, String.Empty)
' Replace

all occurrences of pattern with empty string,
'provided input column is not null
End If
End Sub
End Class

|||

This is pretty Sweet, endless opportunity, unlimited potential.

Thanks,

Larry

|||

This is a SSIS forum, so how about a SSIS solution using REPLACE, may be easier than the Script Component route-

REPLACE(ColumnName, "\t", "")

\t is the escape sequenece for tab in a literal. This expression could be used in a Derived Column transform. Select the Replace "Column" option to clean existing columns in-place.

|||

Many ways to skin the Cat.

Can you do a crlf replace and a lf replace in the same replace statement.

There may be many line feeds and one crlf in the same text field that I am trying to clean.

Thanks,

Larry

|||

Nest the replace statements -

REPLACE(REPLACE(ColumenName, "\r\n", ""), "\n", "")

Or

REPLACE(REPLACE(ColumeName, CHAR(13) + CHAR(10), '', CHAR(10), '')

You could of course do just replace Cr and then Lf in a similar format, I just like the explicit nature of doing CrLf and Lf as units.

Embedded SQL Server Express Deployment - Unhandled Exception: Database already exists

Good Afternoon.

I am trying to write a short application within which I would like to embed a SQL Server Express database, all of which would be deployed via ClickOnce through a web site. The installation process seems to be working without trouble, including installation of the .NET Framework 2.0 and SQL Server Express 2005.

When the application launches on the new machine, however, I get a big Microsoft .NET Framework "Unhandled exception" error dialog box that indicates the database already exists and that the database file could not be attached. I am working with a clean virtual machine that I know has never had the database installed on it.

I fear I am overlooking something quite straightforward, but since this is the first time I have ever attempted to build a data-bound application, I am not sure where I am going wrong.

Perhaps the source of the problem, or a related problem, might be revealed even when I run the application in debug mode from within Visual Studio. I can run the application once, but if I try to run it again, I get an error when I try to open the database connection that is similar in content (database already exists...could not attach). I can run the SSEUtil and detach the database and then run the application again in debug mode and it works no problem (the first time!).

Lastly, if I install the application on the machine on which it was developed and make sure the database is detached, it will run without any trouble (even repeatedly). But, on a new blank machine, there is no database listed that matches my database name, so I cannot try to detach anything!?

My apologies for such a novice question!

Sean

Hi Sean,

I would suggest removing the ‘Initial Catalog’ keyword from your connection string. Among the things that are stored about a database when it is attached is the Name/Path pairing; SQL Server gets a little upset if you try to attach a database using an existing name but with a different path. Enter the |DataDirectory| macro…

I’m guessing you’re using ClickOnce deployment for this application. There are things that will cause the install directory of a ClickOnce deployment to move, when this happens, VS magically fixes up things as far as the application goes, but it cannot fix up the fact that SQL Server has recorded your explicit database as being linked to the old file location. When you attempt to open the application now, the attach fails because there is already a database named JMU_2007 listed in the master database, but it is associated with a different path, so you get the error that the database already exists. I’m guessing this is the problem you’re hitting.

By removing the ‘Initial Catalog’ keyword, you’re forcing SQL Express to give the database an autoname based on its path. If the database moves as a result of VS behavior, the name will be changed because the path has changed, so it will appear to be a different database from the SQL perspective. Hopefully this helps.

Mike

|||

Thanks very much Mike. That did the trick...I can't believe I overlooked that after spending too much time trying to fix this problem.

Sean

Embedded Select vs. UDF

Why is using an embedded SELECT statement faster than using an embedded UDF that has the same exact SQL code within?

Example (not syntax corrected)
Ex1:
SELECT myValue1, myValue2 FROM myTable WHERE aValue = (SELECT Value FROM someTable WHERE myIndex = 800)

is much faster than something like

Ex2:
SELECT myValue1, myValue2 FROM myTable WHERE aValue = (dbo.FN_myUDF(@.vmyIndex))

Given that dbo.FN_myUDF has the same code as the embedded select in the first example.

TIA,

KBActually I'm getting quite an opposite result:

select * from authors where au_id = (select au_id from authors where au_lname = 'Dull')

vs.

create function dbo.fn_get_au_id (
@.lname varchar(50) ) returns char(11)
as begin
declare @.au_id char(11)
select @.au_id = au_id from authors where au_lname = @.lname
return @.au_id
end
go

+

select * from authors where au_id = dbo.fn_get_au_id('Dull')

The first results in: Table 'authors'. Scan count 2, logical reads 3, physical reads 0, read-ahead reads 0.

The second yields: Table 'authors'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0.|||Perhaps because SQL Server is able to take your poorly written code:

SELECT myValue1, myValue2 FROM myTable WHERE aValue = (SELECT Value FROM someTable WHERE myIndex = 800)

...and transform it into the much more efficient:

SELECT myValue1, myValue2
FROM myTable
INNER JOIN someTable on myTable.aValue = someTable.Value
WHERE someTable.myIndex = 800

...prior to executing it. The optimizer will streamline your statement whenever it can, and thus make use of any indexes on the tables and only make one pass through the subtable. Strictly following your code logic would result in a pass through someTable for every record in myTable, which is also what occurs when you call the UDF. The compiler wants none of that nonsense and fixes your code before executing it.|||Well, I just used the same sample code as you (Mr. Lindman) provided and converted it to my previously posted comparative case...and...hmmmmm...It is actually WORSE than the other two:

select * from authors a
inner join authors b
on a.au_id = b.au_id
where b.au_lname = 'Dull'

results in: Table 'authors'. Scan count 2, logical reads 5, physical reads 0, read-ahead reads 0.

In fact, even JOIN hints don't make any difference. Ironic, isn't it? ;)|||My bad. I was thinking he had the function call in his select clause. In the WHERE clause the UDF is only executed once. I get faster results with the UDF as well, though with a larger dataset I get identical results and execution plans using either the subquery method or the join method.sql

Embedded select query?

What I'd like to do is use the result of one query as the input for
another. eg:

INSERT INTO foo VALUES (
(SELECT id FROM people WHERE name = "bar"),
10,
'foobar'
) WHERE
id = 1;

Problem is, MSSQL wants a scalar value. Is there a way around this?
Can someone tell me the correct syntax for what I want to do, or is this
something that will have to be done outside SQL?

Err. Hope I've been clear. Thanks for any help you folks can give.Don't use the VALUES clause if you are INSERTing values from a query. It's
also good practice always to specify the column names in an INSERT
statement.

INSERT INTO foo (col1, col2, col3)
SELECT id, 10, 'foobar'
FROM people
WHERE name = 'bar';

I'm not sure what the final WHERE clause in your code was meant to be so
I've left it out. You can't have a WHERE clause on an INSERT statement.

--
David Portas
SQL Server MVP
--|||Eek. It's been a long day I guess. There wasn't supposed to be a where
on that :) But you've answered my question none the less. Thanks.

FYI, I didn't bother with the column specifications for the sake of
simplicity.

Thanks all the same!

David Portas wrote:
> Don't use the VALUES clause if you are INSERTing values from a query. It's
> also good practice always to specify the column names in an INSERT
> statement.
> INSERT INTO foo (col1, col2, col3)
> SELECT id, 10, 'foobar'
> FROM people
> WHERE name = 'bar';
> I'm not sure what the final WHERE clause in your code was meant to be so
> I've left it out. You can't have a WHERE clause on an INSERT statement.

Embedded Reports

hi,
do i have access to subreports '
for example: how many rows were created?
a have a tablerow with a sub report.
i want to set the visibility to hidden, if no rows were created in the
subreport...
regards
PatrickThe parent report doesn't have access to properties of the subreport.
You may want to consider setting the NoRows property on the subreport
control in the master report.
Or make the subreport control in the master report very small and then have
the subreport hide its own contents if there are no rows of data.
As a last resort, you could put a query in the master report that returns a
count of the rows of the subreport (or if you're calling the subreport
inside of a list, you would include the count as a column in your master
query) and then base the visibility on that count.
--
My employer's lawyers require me to say:
"This posting is provided 'AS IS' with no warranties, and confers no
rights."
"Patrick Ruhnow" <pruhnow@.dornbracht.de> wrote in message
news:uOSD0kAaEHA.556@.tk2msftngp13.phx.gbl...
> hi,
> do i have access to subreports '
> for example: how many rows were created?
> a have a tablerow with a sub report.
> i want to set the visibility to hidden, if no rows were created in the
> subreport...
>
> regards
> Patrick
>

Embedded Queries?

I'm looking into a problem a friend is having, and I'll say right off
the bat that I work with with php and MySQL, and not MS SQL.

What he is attempting to do (in MS SQL) is take two database fields
from a table (string fields), multiply them together, and put them into
a third field. This third column in the table has not yet been created
the time of running the query.

If it needs to be multiple queries, that is fine. My first thought is
to use a simple ALTER query to add the column to the table, then to
call a UPDATE function which uses a select statement inside of it. I'm
not sure if something like this can even be done.

// ---- Suggested query

UPDATE chrisslu SET 'discquantity' = '(SELECT
chrisslu.quantity*chrisslu.nr_of_disc
FROM chrisslu
WHERE (str(period,6)>=? AND str(period,6)<=?))' WHERE
(str(period,6)>=?Andstr(period,6)<=?)

// ---- End Suggested query

It starts with an UPDATE, but replaces the value to be set with a
SELECT statement. I honestly don't even think this query is
syntactically correct, I'm just trying to get the general concept down
:).

So, question the first: Is this type of query possible? The reason
I'm doing this is because I was told MS SQL has no way of storing
temporary variables... otherwise I would just call a SELECT statement,
store the variable, and UPDATE the new field from the variable after
the ALTER statement.

Second question: If it is possible, am I on the right track, or does
it need to be entered in completely different than what I have?

Third: Regarding the 'type'. Do I need to do any kind of typecasting
or conversion of the fields? Both chrisslu.quantity and
chrisslu.nr_of_disc are string fields (that is what I was told, they
may be varchar of some kind). In order to use them in a math
statement, do they have to be floats, or doubles, or something similar?

I appreciate any response, I know this was a long winded question.

ChrisIf the new column is always to be the product of two other columns, why not
use a computed column:

alter table MyTable
add
MyCol as (Col1 * Col2)

--
Tom

----------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com

"Dranai" <dranai@.gmail.com> wrote in message
news:1140277653.986097.250450@.g43g2000cwa.googlegr oups.com...
I'm looking into a problem a friend is having, and I'll say right off
the bat that I work with with php and MySQL, and not MS SQL.

What he is attempting to do (in MS SQL) is take two database fields
from a table (string fields), multiply them together, and put them into
a third field. This third column in the table has not yet been created
the time of running the query.

If it needs to be multiple queries, that is fine. My first thought is
to use a simple ALTER query to add the column to the table, then to
call a UPDATE function which uses a select statement inside of it. I'm
not sure if something like this can even be done.

// ---- Suggested query

UPDATE chrisslu SET 'discquantity' = '(SELECT
chrisslu.quantity*chrisslu.nr_of_disc
FROM chrisslu
WHERE (str(period,6)>=? AND str(period,6)<=?))' WHERE
(str(period,6)>=?Andstr(period,6)<=?)

// ---- End Suggested query

It starts with an UPDATE, but replaces the value to be set with a
SELECT statement. I honestly don't even think this query is
syntactically correct, I'm just trying to get the general concept down
:).

So, question the first: Is this type of query possible? The reason
I'm doing this is because I was told MS SQL has no way of storing
temporary variables... otherwise I would just call a SELECT statement,
store the variable, and UPDATE the new field from the variable after
the ALTER statement.

Second question: If it is possible, am I on the right track, or does
it need to be entered in completely different than what I have?

Third: Regarding the 'type'. Do I need to do any kind of typecasting
or conversion of the fields? Both chrisslu.quantity and
chrisslu.nr_of_disc are string fields (that is what I was told, they
may be varchar of some kind). In order to use them in a math
statement, do they have to be floats, or doubles, or something similar?

I appreciate any response, I know this was a long winded question.

Chris|||That sounds like an excellent idea to look into. Do you know if SQL
will do the math on character fields and insert the data into a float
field?

Occam's law, right? Great suggestion, I'll look into it, thanks.|||You'd just have to cast things (and hope that there were no bugs in the
original data when you added the computed column). Going forward, the two
input columns would have to be numeric:

cast (Col1 as int) * cast (Col2 as int)

--
Tom

----------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Dranai" <dranai@.gmail.com> wrote in message
news:1140283416.620277.318370@.f14g2000cwb.googlegr oups.com...
That sounds like an excellent idea to look into. Do you know if SQL
will do the math on character fields and insert the data into a float
field?

Occam's law, right? Great suggestion, I'll look into it, thanks.|||Great, that is what I was looking for. I am very unfamiliar with the
SQL language, so I had no idea how to typecast. I did some web
browsing for how to do it, and honestly I got too many different
answers, so I wasn't sure which one to use. I was attempting to use
CONVERT(int, col1) first.

Thank you again for the help.

Chris|||Convert works, too. Cast is ANSI, while convert is T-SQL only.

--
Tom

----------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com

"Dranai" <dranai@.gmail.com> wrote in message
news:1140289709.094990.39720@.o13g2000cwo.googlegro ups.com...
Great, that is what I was looking for. I am very unfamiliar with the
SQL language, so I had no idea how to typecast. I did some web
browsing for how to do it, and honestly I got too many different
answers, so I wasn't sure which one to use. I was attempting to use
CONVERT(int, col1) first.

Thank you again for the help.

Chris|||Hey Chris,

Does your friend NEED to store the results of the mathematical
operation in the table, or will the value of this column always be
dependant on the other two columns? If the latter, then simply do the
calculation in the query returning data. No need to waste storage
space (or worry about validation) if the information stored is enough
to calculate your values.

Of course, Tom's suggestion about computed columns doesn't have
physical storage issues, but you have to be aware of the nature of a
computed column when doing an INSERT or UPDATE statement against the
table.

Stu|||Hmm...

I believe the answer to the question is "both". My friends needs to
store the results in the table as a new column, so that later queries
can access the data.

Your last paragraph has given me pause. Could using a computed column
from the query cause problems later on?

The query I was able to come up with is:

// -- Query --
add discquantity as ((cast(chrisslu.quantity as int)) *
cast(chrisslu.nr_of_disc as int))
// -- End Query --

And is returning "function name is missing )". Any thoughts on this?
I didn't believe that the query was related to any function call,
unless each query is considered a function call in MS SQL.

I definately believe we're getting close to a solution here.

Chris|||>From what I can see, you need to include the ALTER TABLE; eg:

ALTER TABLE chrisslu
ADD discquantity AS ((CAST(chrisslu.quantity AS int)) *
CAST(chrisslu.nr_of_disc as int))

As far as whehter or not to use a computed column, it shouldn't be a
problem if:

1. The value of the column is always dependant on the relationship with
the other columns;
2. You always use explicit column names when inserting or updating
data, and;
3. You don't plan on porting this database to another RDBMS engine.

Stu|||OK, great, none of those should be problems. Thank you for the
clarification.

Chris