Tuesday, March 27, 2012
DistinctCount
that can either be a valid value, an empty string or null - I believe the
nulls are being discarded in the counts, but is there a way to make sure that
the empty strings are not being counted?This may be out of your jurisdiction, but it sounds like the data needs to be
cleansed? If NULL is valid in the column then you probably shouldn't have
empty string. In any case, if you're using stored procedures, which would be
the recommendation, you can perform some data cleanup there so you're left
with valid values. I'd check with the DBA on why there are both empty
strings and NULLS and use one or the other for absence of "valid data"
"Myles" wrote:
> I am running into a problem using DistinctCount - I have values in the report
> that can either be a valid value, an empty string or null - I believe the
> nulls are being discarded in the counts, but is there a way to make sure that
> the empty strings are not being counted?|||Yes J.P., thank you - you hit the nail on the head - on all accounts.
Unfortunately, I am already 'blue' in the face - but suppose the right thing
to do is hit my head again...I am not sure it is going to change anything,
however, and so am still looking for a way to filter this stuff out of the
counts. Thanks for the reply!
"JP.Sklenka" wrote:
> This may be out of your jurisdiction, but it sounds like the data needs to be
> cleansed? If NULL is valid in the column then you probably shouldn't have
> empty string. In any case, if you're using stored procedures, which would be
> the recommendation, you can perform some data cleanup there so you're left
> with valid values. I'd check with the DBA on why there are both empty
> strings and NULLS and use one or the other for absence of "valid data"
> "Myles" wrote:
> > I am running into a problem using DistinctCount - I have values in the report
> > that can either be a valid value, an empty string or null - I believe the
> > nulls are being discarded in the counts, but is there a way to make sure that
> > the empty strings are not being counted?|||Myles,
Try using the COALESCE(fieldname,0) function in your SQL to change Null
into what is more appropriate, or you could use the CASE WHEN trim(fieldname)
= â'â' THEN null ELSE fieldname END statement to change the empty strings to
nulls.
You could also consider using the filter section of the dataset.
HTH
-walter
"Myles" wrote:
> Yes J.P., thank you - you hit the nail on the head - on all accounts.
> Unfortunately, I am already 'blue' in the face - but suppose the right thing
> to do is hit my head again...I am not sure it is going to change anything,
> however, and so am still looking for a way to filter this stuff out of the
> counts. Thanks for the reply!
>
> "JP.Sklenka" wrote:
> > This may be out of your jurisdiction, but it sounds like the data needs to be
> > cleansed? If NULL is valid in the column then you probably shouldn't have
> > empty string. In any case, if you're using stored procedures, which would be
> > the recommendation, you can perform some data cleanup there so you're left
> > with valid values. I'd check with the DBA on why there are both empty
> > strings and NULLS and use one or the other for absence of "valid data"
> >
> > "Myles" wrote:
> >
> > > I am running into a problem using DistinctCount - I have values in the report
> > > that can either be a valid value, an empty string or null - I believe the
> > > nulls are being discarded in the counts, but is there a way to make sure that
> > > the empty strings are not being counted?
Wednesday, March 21, 2012
Displayong "Empty string" to a textbox on the report
Hi All!
I was checking the value of a field and if it is empty sending empty string to the textbox if not only the first few values and it is working but on the empty field something like "#Error" is being displayed.
here is the code:
=Iif(Fields!Lname.Value <>””, Fields!Lname.Value.ToString().Substring(0,10),"")
What I want to acheve is : If it is not zero to take the first 10 characters and if not to send an epmity string to the textbox.
Any help plz?
Thank you in advance!
In your expression, you are making the assumption that the string will be at least 10 characters. If it isn't 10 characters you will get an error. I am not sure what you are trying to accomplish but see the expression below. It will truncate the field if it is over 10 characters.
=Iif(Fields!Lname.Value.ToString().Length() > 10, Fields!Lname.Value.ToString().Substring(0,10), Fields!Lname.Value)
|||
here is the code:
=Iif(Fields!Lname.Value <>””, Fields!Lname.Value.ToString().Substring(0,10),"")
What I want to acheve is : If it is not zero to take the first 10 characters and if not to send an epmity string to the textbox
Thank you.The one that you send to me is not doing what i was looking for. Thank you very much.
|||My expression does the exact same thing as yours except when there are less than 10 characters it will not attempt to truncate.
Input and output for my expression:
Input and output for your expression
If I am getting it right, the problem I think is that when that field is empty or NULL, it returns an error:
So in your code actually, the first line for input and output would be:
"" --> #Error
I dunno how to resolve this in RS as I tried various things and they didn't work (like length = 0 etc.), only thing I can think of for now is to modify your query itself to return the substring instead of the field and then use this new field..
e,g,
select .....,..,.., substring(ISNULL(OldFieldName,''), 0, 10) as NewFieldName
from TableName
|||Ryan Ackley MSFT wrote:
My expression does the exact same thing as yours except when there are less than 10 characters it will not attempt to truncate.
Input and output for my expression:
"" -> "" "foo" -> "foo" "bar" -> "bar" "SomeReallyLongString" -> "SomeReally"
Input and output for your expression
"" -> "" "foo" -> "#Error" "bar" -> "#Error" "SomeReallyLongString" -> "SomeReally"
Thank you very much. This is exactly what the problem that I am facing now let me try to see some other things and I will do as you suggest. Thank you.If you find anything new plz let me know.
Ephi
Friday, March 9, 2012
Displaying De-Serialized Images in Reports
I have a field in my SQL Server database that is called "Ink" and is Text as
the datatype.
I have put into this field a Base64 String which represents serialized
digital ink collected on a Tablet PC.
I wrote a small piece of Custom Code in the Report to de-serialize the ink
and transform it into System.Drawing.Bitmap, but it does not render in the
report.
QUESTION
Is it possible to display images in a report from a function that returns a
data type of System.Drawing.Bitmap?
If not, can I ask how you are planning to implement digital INK support in
databases?
--
Shawn Nanto
Leszynski Group, Inc.
Bellevue, WAImages can be directly displayed when they are returned as Base64 encoded
byte array. The image type has to be "Database" and you must set the
MimeType to the correct image format.
Note: System.Drawing.Bitmap is not supported.
The relevant section in the RDL file would look similar to this:
<Image>
<MIMEType>image/bmp</MIMEType>
<Source>Database</Source>
<Value>=Fields!InkImage.Value</Value>
...
</Image>
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shawn Nanto" <ShawnNanto@.discussions.microsoft.com> wrote in message
news:0A54FC08-2ECB-4996-B585-5F7E4BA3A8C9@.microsoft.com...
> PREFACE:
> I have a field in my SQL Server database that is called "Ink" and is Text
as
> the datatype.
> I have put into this field a Base64 String which represents serialized
> digital ink collected on a Tablet PC.
> I wrote a small piece of Custom Code in the Report to de-serialize the ink
> and transform it into System.Drawing.Bitmap, but it does not render in the
> report.
> QUESTION
> Is it possible to display images in a report from a function that returns
a
> data type of System.Drawing.Bitmap?
> If not, can I ask how you are planning to implement digital INK support in
> databases?
>
> --
> Shawn Nanto
> Leszynski Group, Inc.
> Bellevue, WA
Friday, February 24, 2012
display string having length greater than 255
I have a created a table and entered data into the table as follows:
CREATE TABLE t ( id INT , txtcol varchar(1000) )
INSERT INTO t ( id , txtcol ) VALUES ( 1 , 'ATXR_SOURCE_ID,CDDL_AG_PRICE,CDDL_ALLOW,CDDL_ALTDP_EXCD_ID,CDDL_CAP_IND,CDDL_CHG_AMT,CDDL_COINS_AMT,CDDL_CONSIDER_CHG,CDDL_COPAY_AMT,CDDL_DED_AC_NO,CDDL_DED_AMT,CDDL_DIS_PA_LIAB,CDDL_DISALL_AMT,CDDL_DISALL_EXCD,CDDL_DISC_AMT,CDDL_DP_PRICE,CDDL_FROM_DT,CDDL_PAID_AMT,CDDL_PF_PRICE,CDDL_PR_PYMT_AMT,CDDL_PRICE_IND,CDDL_REF_IND,CDDL_RISK_WH_AMT,CDDL_SB_PYMT_AMT,CDDL_SURF,CDDL_TOOTH_BEG,CDDL_TOOTH_END,CDDL_TOOTH_NO,CDDL_TOT_PA_LIAB,CDDL_UNITS,CDDL_UNITS_ALLOW,CGCG_ID,CGCG_RULE,DPCG_DP_ID_ALT,DPDP_ID,DPTC_CD,PDVC_LOBD_PTR,PSDC_ID,UTUT_CD' )
Now if i select data using the query below the txtcol field displays only 255 characters :
SELECT * FROM t
Y is this happening?
This is happening because of your client application (QA, SSMS or something else) has a setting not to display field values grater than 255 bytes. Inspect application options, then.
Display RTF String
I have a rtf string saved in a SQL Server Db which i want to display on the
report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
Is this possible in SSRS? If yes then kindly provide some help on the
implementation.Rich text and html is not supported in this release or Yukon, Html will be
supported in the next release after SQL 2005 but I do not know about rich
text...
You could create your own rich text textbox and in custom dll and add it to
the tools ...
--
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
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> Hi,
> I have a rtf string saved in a SQL Server Db which i want to display on
> the
> report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> Is this possible in SSRS? If yes then kindly provide some help on the
> implementation.
>|||How do i add a custom control to the report? I created a rtf user control -
after adding it in the report designer toolbox - it is disabled for selection.
Pardon my ignorance here. I am using SSRS 2000.
--
Afaq
"Wayne Snyder" wrote:
> Rich text and html is not supported in this release or Yukon, Html will be
> supported in the next release after SQL 2005 but I do not know about rich
> text...
> You could create your own rich text textbox and in custom dll and add it to
> the tools ...
> --
> 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
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> > Hi,
> >
> > I have a rtf string saved in a SQL Server Db which i want to display on
> > the
> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> >
> > Is this possible in SSRS? If yes then kindly provide some help on the
> > implementation.
> >
>
>|||You can't do this for RS 2000. I gather that this will be possible with RS
2005.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
> How do i add a custom control to the report? I created a rtf user
> control -
> after adding it in the report designer toolbox - it is disabled for
> selection.
> Pardon my ignorance here. I am using SSRS 2000.
> --
> Afaq
>
> "Wayne Snyder" wrote:
>> Rich text and html is not supported in this release or Yukon, Html will
>> be
>> supported in the next release after SQL 2005 but I do not know about rich
>> text...
>> You could create your own rich text textbox and in custom dll and add it
>> to
>> the tools ...
>> --
>> 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
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
>> > Hi,
>> >
>> > I have a rtf string saved in a SQL Server Db which i want to display on
>> > the
>> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
>> >
>> > Is this possible in SSRS? If yes then kindly provide some help on the
>> > implementation.
>> >
>>|||Uh Oh...
So to summarise- i cant display rtf in SSRS 2000
--
Afaq
"Bruce L-C [MVP]" wrote:
> You can't do this for RS 2000. I gather that this will be possible with RS
> 2005.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
> > How do i add a custom control to the report? I created a rtf user
> > control -
> > after adding it in the report designer toolbox - it is disabled for
> > selection.
> >
> > Pardon my ignorance here. I am using SSRS 2000.
> >
> > --
> > Afaq
> >
> >
> > "Wayne Snyder" wrote:
> >
> >> Rich text and html is not supported in this release or Yukon, Html will
> >> be
> >> supported in the next release after SQL 2005 but I do not know about rich
> >> text...
> >>
> >> You could create your own rich text textbox and in custom dll and add it
> >> to
> >> the tools ...
> >>
> >> --
> >> 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
> >>
> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> >> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> >> > Hi,
> >> >
> >> > I have a rtf string saved in a SQL Server Db which i want to display on
> >> > the
> >> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> >> >
> >> > Is this possible in SSRS? If yes then kindly provide some help on the
> >> > implementation.
> >> >
> >>
> >>
> >>
>
>|||Nope.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:F1541CCC-4609-4BCF-8684-FD8C553AB6AD@.microsoft.com...
> Uh Oh...
> So to summarise- i cant display rtf in SSRS 2000
> --
> Afaq
>
> "Bruce L-C [MVP]" wrote:
>> You can't do this for RS 2000. I gather that this will be possible with
>> RS
>> 2005.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
>> > How do i add a custom control to the report? I created a rtf user
>> > control -
>> > after adding it in the report designer toolbox - it is disabled for
>> > selection.
>> >
>> > Pardon my ignorance here. I am using SSRS 2000.
>> >
>> > --
>> > Afaq
>> >
>> >
>> > "Wayne Snyder" wrote:
>> >
>> >> Rich text and html is not supported in this release or Yukon, Html
>> >> will
>> >> be
>> >> supported in the next release after SQL 2005 but I do not know about
>> >> rich
>> >> text...
>> >>
>> >> You could create your own rich text textbox and in custom dll and add
>> >> it
>> >> to
>> >> the tools ...
>> >>
>> >> --
>> >> 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
>> >>
>> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> >> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I have a rtf string saved in a SQL Server Db which i want to display
>> >> > on
>> >> > the
>> >> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
>> >> >
>> >> > Is this possible in SSRS? If yes then kindly provide some help on
>> >> > the
>> >> > implementation.
>> >> >
>> >>
>> >>
>> >>
>>|||Actually you can, but it requires code in an external assembly.
Here is one option:
1. Create a ClassLibrary project in C# or VB.NET.
2. Add a reference to the System.Windows.Forms.dll
3. Create a class such as ConversionUtility
4. Add the appropriate import/using statement using
System.Windows.Forms; to your class.
5. Create a method that uses the RichTextBox WinForms control to do the
heavy-lifting:
public static string ConvertRTFToText(string RTF)
{
RichTextBox richTextBox = new RichTextBox();
richTextBox.Rtf = richText;
return richTextBox.Text;
}
6. Compile this assembly, and deploy it to your ReportServer folder or
the GAC
7. Reference the Assembly from the Report and call this method.
The result is a text version of the RTF. It will not include any
formatting, embedded pictures, or markup, however the text will show up
just fine. I use this approach with J.D. Edwards XE One World software
because they have a "Media Objects" table containing key information
input by the users.
Note: This approach is a bit of a hack because of its abuse of the
RichTextBox control. Another route would be to buy or find an RTF
Conversion class library so you don't have the overhead of the windows
forms control.
Hope this gives you another option.
Lance
http://www.lance-hunt.net/|||Lance,
Thanks for the reply. The RTF string if converted to text is useless to me
as it loses its formatiing.
Can we parse it to html and display it?
Afaq Choonawala
"Lance" wrote:
> Actually you can, but it requires code in an external assembly.
> Here is one option:
> 1. Create a ClassLibrary project in C# or VB.NET.
> 2. Add a reference to the System.Windows.Forms.dll
> 3. Create a class such as ConversionUtility
> 4. Add the appropriate import/using statement using
> System.Windows.Forms; to your class.
> 5. Create a method that uses the RichTextBox WinForms control to do the
> heavy-lifting:
> public static string ConvertRTFToText(string RTF)
> {
> RichTextBox richTextBox = new RichTextBox();
> richTextBox.Rtf = richText;
> return richTextBox.Text;
> }
> 6. Compile this assembly, and deploy it to your ReportServer folder or
> the GAC
> 7. Reference the Assembly from the Report and call this method.
> The result is a text version of the RTF. It will not include any
> formatting, embedded pictures, or markup, however the text will show up
> just fine. I use this approach with J.D. Edwards XE One World software
> because they have a "Media Objects" table containing key information
> input by the users.
> Note: This approach is a bit of a hack because of its abuse of the
> RichTextBox control. Another route would be to buy or find an RTF
> Conversion class library so you don't have the overhead of the windows
> forms control.
> Hope this gives you another option.
> Lance
> http://www.lance-hunt.net/
>|||Not likely. Any HTML would end up encoded so it would only show the
literal HTML tags on the page.
At this point, I'm out of ideas. Frankly the only other options are a
bit too extreme and painful. Such as writing your own custom
RenderingExtension so that it will "properly" handle your RTF. Even
with this approach it would be a chore.
Good luck...
Lance
Friday, February 17, 2012
Display NULL as BLANK ?
I find that fields with NULL value is displayed as "NULL" string. In SQL
Server 2000, NULL value is displayed as BLANK.
Is there any option in Management Studio to be set up so that NULL value can
be exported as BLANK ?
If not, what is the best way to handle it (End users expect that NULL string
should not be displayed) ?
ThanksPeter
Are you sure? I have a table with column defined as smallint and allows
NULLS. I got NULL on both SQL 2000 (SP3) and SQL Server 2005 (SP2)
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>I am new to SQL Server 2005. When I choose "Results to File" for a query,
> I find that fields with NULL value is displayed as "NULL" string. In SQL
> Server 2000, NULL value is displayed as BLANK.
> Is there any option in Management Studio to be set up so that NULL value
> can
> be exported as BLANK ?
> If not, what is the best way to handle it (End users expect that NULL
> string
> should not be displayed) ?
> Thanks
>|||Not sure of a setting that controls this of the top of my head, however, you
could try something like this...
declare @.var varchar(10)
select @.var = NULL
select case when @.var IS NULL then '' else @.var end
Immy
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>I am new to SQL Server 2005. When I choose "Results to File" for a query,
> I find that fields with NULL value is displayed as "NULL" string. In SQL
> Server 2000, NULL value is displayed as BLANK.
> Is there any option in Management Studio to be set up so that NULL value
> can
> be exported as BLANK ?
> If not, what is the best way to handle it (End users expect that NULL
> string
> should not be displayed) ?
> Thanks
>|||Dear Uri,
With SQL Server 2000 Query Analyser (SP4), I run the same query and choose
"Result to file", NULL value is shown as BLANK.
On the other hand, when I use Management Studio (SP2) today, I really get
NULL as string.
Peter
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eLLbzLZsHHA.1168@.TK2MSFTNGP02.phx.gbl...
> Peter
> Are you sure? I have a table with column defined as smallint and allows
> NULLS. I got NULL on both SQL 2000 (SP3) and SQL Server 2005 (SP2)
>
>
> "Peter" <Peter@.discussions.microsoft.com> wrote in message
> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>|||Or, shorten it down to ISNULL or COLAESCE:
SELECT ISNULL(colname, ''), ...
SELECT COALESCE(colname, ''), ...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Immy" <therealasianbabe@.hotmail.com> wrote in message
news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
> Not sure of a setting that controls this of the top of my head, however, y
ou could try something
> like this...
> declare @.var varchar(10)
> select @.var = NULL
> select case when @.var IS NULL then '' else @.var end
> Immy
> "Peter" <Peter@.discussions.microsoft.com> wrote in message
> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>|||and that version too ;)
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:2DF5290B-A646-4C6D-A85B-23EB5C6B6851@.microsoft.com...
> Or, shorten it down to ISNULL or COLAESCE:
> SELECT ISNULL(colname, ''), ...
> SELECT COALESCE(colname, ''), ...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Immy" <therealasianbabe@.hotmail.com> wrote in message
> news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
>|||Dear Tibor / Immy,
Many thanks for your advice.
Peter
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:2DF5290B-A646-4C6D-A85B-23EB5C6B6851@.microsoft.com...
> Or, shorten it down to ISNULL or COLAESCE:
> SELECT ISNULL(colname, ''), ...
> SELECT COALESCE(colname, ''), ...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Immy" <therealasianbabe@.hotmail.com> wrote in message
> news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
>
Display NULL as BLANK ?
I find that fields with NULL value is displayed as "NULL" string. In SQL
Server 2000, NULL value is displayed as BLANK.
Is there any option in Management Studio to be set up so that NULL value can
be exported as BLANK ?
If not, what is the best way to handle it (End users expect that NULL string
should not be displayed) ?
ThanksPeter
Are you sure? I have a table with column defined as smallint and allows
NULLS. I got NULL on both SQL 2000 (SP3) and SQL Server 2005 (SP2)
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>I am new to SQL Server 2005. When I choose "Results to File" for a query,
> I find that fields with NULL value is displayed as "NULL" string. In SQL
> Server 2000, NULL value is displayed as BLANK.
> Is there any option in Management Studio to be set up so that NULL value
> can
> be exported as BLANK ?
> If not, what is the best way to handle it (End users expect that NULL
> string
> should not be displayed) ?
> Thanks
>|||Not sure of a setting that controls this of the top of my head, however, you
could try something like this...
declare @.var varchar(10)
select @.var = NULL
select case when @.var IS NULL then '' else @.var end
Immy
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>I am new to SQL Server 2005. When I choose "Results to File" for a query,
> I find that fields with NULL value is displayed as "NULL" string. In SQL
> Server 2000, NULL value is displayed as BLANK.
> Is there any option in Management Studio to be set up so that NULL value
> can
> be exported as BLANK ?
> If not, what is the best way to handle it (End users expect that NULL
> string
> should not be displayed) ?
> Thanks
>|||Dear Uri,
With SQL Server 2000 Query Analyser (SP4), I run the same query and choose
"Result to file", NULL value is shown as BLANK.
On the other hand, when I use Management Studio (SP2) today, I really get
NULL as string.
Peter
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eLLbzLZsHHA.1168@.TK2MSFTNGP02.phx.gbl...
> Peter
> Are you sure? I have a table with column defined as smallint and allows
> NULLS. I got NULL on both SQL 2000 (SP3) and SQL Server 2005 (SP2)
>
>
> "Peter" <Peter@.discussions.microsoft.com> wrote in message
> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>>I am new to SQL Server 2005. When I choose "Results to File" for a
>>query,
>> I find that fields with NULL value is displayed as "NULL" string. In SQL
>> Server 2000, NULL value is displayed as BLANK.
>> Is there any option in Management Studio to be set up so that NULL value
>> can
>> be exported as BLANK ?
>> If not, what is the best way to handle it (End users expect that NULL
>> string
>> should not be displayed) ?
>> Thanks
>>
>|||Or, shorten it down to ISNULL or COLAESCE:
SELECT ISNULL(colname, ''), ...
SELECT COALESCE(colname, ''), ...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Immy" <therealasianbabe@.hotmail.com> wrote in message
news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
> Not sure of a setting that controls this of the top of my head, however, you could try something
> like this...
> declare @.var varchar(10)
> select @.var = NULL
> select case when @.var IS NULL then '' else @.var end
> Immy
> "Peter" <Peter@.discussions.microsoft.com> wrote in message
> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>>I am new to SQL Server 2005. When I choose "Results to File" for a query,
>> I find that fields with NULL value is displayed as "NULL" string. In SQL
>> Server 2000, NULL value is displayed as BLANK.
>> Is there any option in Management Studio to be set up so that NULL value can
>> be exported as BLANK ?
>> If not, what is the best way to handle it (End users expect that NULL string
>> should not be displayed) ?
>> Thanks
>>
>|||and that version too ;)
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:2DF5290B-A646-4C6D-A85B-23EB5C6B6851@.microsoft.com...
> Or, shorten it down to ISNULL or COLAESCE:
> SELECT ISNULL(colname, ''), ...
> SELECT COALESCE(colname, ''), ...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Immy" <therealasianbabe@.hotmail.com> wrote in message
> news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
>> Not sure of a setting that controls this of the top of my head, however,
>> you could try something like this...
>> declare @.var varchar(10)
>> select @.var = NULL
>> select case when @.var IS NULL then '' else @.var end
>> Immy
>> "Peter" <Peter@.discussions.microsoft.com> wrote in message
>> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>>I am new to SQL Server 2005. When I choose "Results to File" for a
>>query,
>> I find that fields with NULL value is displayed as "NULL" string. In
>> SQL
>> Server 2000, NULL value is displayed as BLANK.
>> Is there any option in Management Studio to be set up so that NULL value
>> can
>> be exported as BLANK ?
>> If not, what is the best way to handle it (End users expect that NULL
>> string
>> should not be displayed) ?
>> Thanks
>>
>>
>|||Dear Tibor / Immy,
Many thanks for your advice.
Peter
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:2DF5290B-A646-4C6D-A85B-23EB5C6B6851@.microsoft.com...
> Or, shorten it down to ISNULL or COLAESCE:
> SELECT ISNULL(colname, ''), ...
> SELECT COALESCE(colname, ''), ...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Immy" <therealasianbabe@.hotmail.com> wrote in message
> news:%23fhkAPZsHHA.3640@.TK2MSFTNGP05.phx.gbl...
>> Not sure of a setting that controls this of the top of my head, however,
>> you could try something like this...
>> declare @.var varchar(10)
>> select @.var = NULL
>> select case when @.var IS NULL then '' else @.var end
>> Immy
>> "Peter" <Peter@.discussions.microsoft.com> wrote in message
>> news:O3CWN6YsHHA.1416@.TK2MSFTNGP06.phx.gbl...
>>I am new to SQL Server 2005. When I choose "Results to File" for a
>>query,
>> I find that fields with NULL value is displayed as "NULL" string. In
>> SQL
>> Server 2000, NULL value is displayed as BLANK.
>> Is there any option in Management Studio to be set up so that NULL value
>> can
>> be exported as BLANK ?
>> If not, what is the best way to handle it (End users expect that NULL
>> string
>> should not be displayed) ?
>> Thanks
>>
>>
>
Tuesday, February 14, 2012
Display dropdown parameter label on report
integer and the display field as a string. How can I display the selected
'display' field on the report? I can display the ID (int) ok with
= Parameters!SiteID.Value
But how can I get the actual selected dropdown text? Can't find this
anywhere!
cheers,
SimonYou can try:
= Parameters!SiteID.Label
"Anonymous Poster" wrote:
> I have a dropdown parameter in my report (Sites) with the ID field as a
> integer and the display field as a string. How can I display the selected
> 'display' field on the report? I can display the ID (int) ok with
> = Parameters!SiteID.Value
> But how can I get the actual selected dropdown text? Can't find this
> anywhere!
> cheers,
> Simon
>
>|||Excellent! Thanks
Simon
"Andre" <Andre@.discussions.microsoft.com> wrote in message
news:CE5FD740-6859-4830-AA02-76C8C97AED34@.microsoft.com...
> You can try:
> = Parameters!SiteID.Label
>
> "Anonymous Poster" wrote:
> > I have a dropdown parameter in my report (Sites) with the ID field as a
> > integer and the display field as a string. How can I display the
selected
> > 'display' field on the report? I can display the ID (int) ok with
> >
> > = Parameters!SiteID.Value
> >
> > But how can I get the actual selected dropdown text? Can't find this
> > anywhere!
> >
> > cheers,
> >
> > Simon
> >
> >
> >