Thursday, March 29, 2012
boolean value in column
return three columns based on the value: 1, 2, or 3. If the field name is
"Action", I should be able to sum (action=1), (action=2), and (action=3).
First I tried the following:
SELECT SU.SProc, SUM(SU.[Action] = 1), SUM(SU.[Action] = 2), SUM(SU.[Action]
= 3)
The result of each would be -1 or zero. That doesn't work, I guess because
no boolean data type exists. Using CAST or CONVERT doesn't work either for
the same reason: (SU.[Action] = 1) cannot be interpreted. So thought I would
try IF/ELSE, but cannot get the syntax right. I've used it before but can't
remember how I did it. May have been with DB2. Should go something like:
SELECT SU.SProc, SUM(IF SU.[Action] = 1 BEGIN 1 END ELSE BEGIN 0 END),
SUM(IF SU.[Action] = 2 BEGIN 1 END ELSE BEGIN 0 END), SUM(IF SU.[Action] = 3
BEGIN 1 END ELSE BEGIN 0 END)
If someone would enlighten me I'd appreciate it. ThanksSELECT
SUM CASE WHEN foobar_action = 1 then 1 ELSE 0 END) AS total_1,
SUM CASE WHEN foobar_action = 2 then 1 ELSE 0 END) AS total_2,
SUM CASE WHEN foobar_action = 3 then 1 ELSE 0 END) AS total_3
FROM Foobar;|||David McDivitt wrote:
> I need to do an aggregate query against an integer data type, and
> want to return three columns based on the value: 1, 2, or 3. If the
> field name is "Action", I should be able to sum (action=1),
> (action=2), and (action=3). First I tried the following:
> SELECT SU.SProc, SUM(SU.[Action] = 1), SUM(SU.[Action] = 2),
> SUM(SU.[Action] = 3)
> The result of each would be -1 or zero. That doesn't work, I guess
> because no boolean data type exists. Using CAST or CONVERT doesn't
> work either for the same reason: (SU.[Action] = 1) cannot be
> interpreted. So thought I would try IF/ELSE, but cannot get the
> syntax right. I've used it before but can't remember how I did it.
> May have been with DB2. Should go something like:
> SELECT SU.SProc, SUM(IF SU.[Action] = 1 BEGIN 1 END ELSE BEGIN 0 END),
> SUM(IF SU.[Action] = 2 BEGIN 1 END ELSE BEGIN 0 END), SUM(IF
> SU.[Action] = 3 BEGIN 1 END ELSE BEGIN 0 END)
> If someone would enlighten me I'd appreciate it. Thanks
Try using a CASE statement:
create table #abc (action int)
insert into #abc values (1)
insert into #abc values (2)
insert into #abc values (2)
insert into #abc values (3)
insert into #abc values (3)
insert into #abc values (3)
Select
SUM( CASE action
WHEN 1 THEN 1
ELSE 0
END ) as "Action 1",
SUM( CASE action
WHEN 2 THEN 1
ELSE 0
END ) as "Action 2",
SUM( CASE action
WHEN 3 THEN 1
ELSE 0
END ) as "Action 3"
From #abc
Action 1 Action 2 Action 3
-- -- --
1 2 3
drop table #abc
David Gugick
Quest Software
www.imceda.com
www.quest.com|||Look up CASE WHEN in BOL
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com
"David McDivitt" <x12code-del@.del-yahoo.com> wrote in message
news:ve9pg1dr6kvo45sc4s2mmmt003cisrhg6t@.
4ax.com...
>I need to do an aggregate query against an integer data type, and want to
> return three columns based on the value: 1, 2, or 3. If the field name is
> "Action", I should be able to sum (action=1), (action=2), and (action=3).
> First I tried the following:
> SELECT SU.SProc, SUM(SU.[Action] = 1), SUM(SU.[Action] = 2),
> SUM(SU.[Action]
> = 3)
> The result of each would be -1 or zero. That doesn't work, I guess because
> no boolean data type exists. Using CAST or CONVERT doesn't work either for
> the same reason: (SU.[Action] = 1) cannot be interpreted. So thought I
> would
> try IF/ELSE, but cannot get the syntax right. I've used it before but
> can't
> remember how I did it. May have been with DB2. Should go something like:
> SELECT SU.SProc, SUM(IF SU.[Action] = 1 BEGIN 1 END ELSE BEGIN 0 END),
> SUM(IF SU.[Action] = 2 BEGIN 1 END ELSE BEGIN 0 END), SUM(IF SU.[Action] =
> 3
> BEGIN 1 END ELSE BEGIN 0 END)
> If someone would enlighten me I'd appreciate it. Thanks
>|||>From: "David Gugick" <david.gugick-nospam@.quest.com>
>Date: Wed, 24 Aug 2005 13:17:27 -0400
>Lines: 62
>David McDivitt wrote:
>Try using a CASE statement:
>create table #abc (action int)
>insert into #abc values (1)
>insert into #abc values (2)
>insert into #abc values (2)
>insert into #abc values (3)
>insert into #abc values (3)
>insert into #abc values (3)
>Select
> SUM( CASE action
> WHEN 1 THEN 1
> ELSE 0
Thanks guys the CASE statement was what I was looking for.
Boolean Report Parameters
Hi, I have created a report parameter using a Boolean data type.
When I preview my Report I can select either True or False for this parameter. Is there any way of changing the 'True' label to say something else and again the same with the 'False' label?
Click on Report-Parameters
Select your parameter and go down to Available Values
Type in a label and the value
ex.
Open - True
Closed - False
Simone
|||This brings the values up in a list box, I was hoping to keep the selection as tick boxes but amend 'True' to say 'Open' for example.|||I ran into the same issue today when I tried to change "String" parameter to "Boolean", and hoping to have radiobox instead of listbox dropdown.
No good, it'd be boolean type with dropdown, which is the same as "String" type essentially
It'd be nice to able to change label for "True" and "False"
Boolean parameter label
I have a parameter of type Boolean. The available values are non-queried
with labels 'YES' and 'NO' and the values are obviously True and False,
respectively. When the report renders, I get the two option buttons, but the
labels are 'true' and 'false'. What did I miss?
--
Michael White
Programmer/Analyst
Marion County, ORIIRC available values and labels are not applicable in case of boolean
parameter.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael" <xxx.xxx.xxx> wrote in message
news:%2311IFe5ZFHA.3224@.TK2MSFTNGP10.phx.gbl...
> Hi all..
> I have a parameter of type Boolean. The available values are non-queried
> with labels 'YES' and 'NO' and the values are obviously True and False,
> respectively. When the report renders, I get the two option buttons, but
> the
> labels are 'true' and 'false'. What did I miss?
> --
> Michael White
> Programmer/Analyst
> Marion County, OR
>sql
Boolean formatting in report
I render this data on the report the value of 0 displays as "False"
and 1 displays as "True". I would like 0 to display as "No" and 1 to
display as "Yes". I am assuming I have to set up an IIF statement
that evaluates the value and changes the display based on that. I was
wondering if anyone knew of a better way, such as a Custom Format
value that would be a better route?
Thanks in advance for any assistance!On Sep 20, 2:03 pm, midas <mcneeley1...@.yahoo.com> wrote:
> I have a data source with a column that is a boolean data type. When
> I render this data on the report the value of 0 displays as "False"
> and 1 displays as "True". I would like 0 to display as "No" and 1 to
> display as "Yes". I am assuming I have to set up an IIF statement
> that evaluates the value and changes the display based on that. I was
> wondering if anyone knew of a better way, such as a Custom Format
> value that would be a better route?
> Thanks in advance for any assistance!
The way you mentioned is quick and the effort is negligible.
=iif(Fields!SomeField.Value = True, "Yes", "No") -or- =iif(Fields!
SomeField.Value = 1, "Yes", "No")
You could also try using a case statement in the query/stored
procedure that is sourcing the report.
select case when SomeField = 'True' then 'Yes' else 'No' end as
SomeField, ... from table_x ...
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Thanks, I went with the case. I was just trying to be lazy. ;)|||On Sep 21, 2:57 pm, midas <mcneeley1...@.yahoo.com> wrote:
> Thanks, I went with the case. I was just trying to be lazy. ;)
You're welcome. Glad I could be of assistance.
Regards,
Enrique Martinez
Sr. Software Consultantsql
Tuesday, March 27, 2012
Boolean datatypes
How to create fields with boolean datatypes? There seems to be no 'boolean'
SQL data type. Can the bit datatype be used to store 0 for false and 1 for
true?
Thanks,
kdkd,
There are no boolean datatype in SQL Server 7/2000. You can use bit (or
another "numeric" datatype, tinyint for example) or use a char(1)
storing "F"/"T" (or "Y"/"N" or whatever). Bit is normally "converted" to
a boolean by ADO (but I'm not sure if bit=0 is TRUE or FALSE, I _think_
it "means" FALSE...).
Lars Broberg
Elbe-Data AB
http://www.elbe-data.se
Remove "nothing." when replying to private e-mail!
kd wrote:
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd|||You are correct that there is no Boolean datatype in SQL Server. You can choose whatever you want to
represent what you want to call "true" and "false", these will only be values of that datatype for
SQL Server. Some programming environments will consider bit as Boolean and bind such automatically;
but to SQL Server, bit is a numeric datatype restricted to 0 and 1 (*). There has been several
discussions ion this group and .programming on the subject and I recommend that you check the
archives and determine whether you want to use bit or, for example, char(1) with a check constraint
restricting to 't' pr 'f', 'y' or 'n' etc (see the old discussions other options exists).
(*) One strange thing with the bit datatype in SQL Server is that you will not get an overflow if
you assign, for instance, the value 2 to a bit datatype. The result will be 1.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd|||In addition to the other comments... When deciding whether to use bit or
char(1), you are (essentially) weighing the space savings of bit, versus the
ease of printing with a char(1)( no conversion on output)...
--
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
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no
> 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd
Boolean datatypes
How to create fields with boolean datatypes? There seems to be no 'boolean'
SQL data type. Can the bit datatype be used to store 0 for false and 1 for
true?
Thanks,
kd
kd,
There are no boolean datatype in SQL Server 7/2000. You can use bit (or
another "numeric" datatype, tinyint for example) or use a char(1)
storing "F"/"T" (or "Y"/"N" or whatever). Bit is normally "converted" to
a boolean by ADO (but I'm not sure if bit=0 is TRUE or FALSE, I _think_
it "means" FALSE...).
Lars Broberg
Elbe-Data AB
http://www.elbe-data.se
Remove "nothing." when replying to private e-mail!
kd wrote:
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd
|||You are correct that there is no Boolean datatype in SQL Server. You can choose whatever you want to
represent what you want to call "true" and "false", these will only be values of that datatype for
SQL Server. Some programming environments will consider bit as Boolean and bind such automatically;
but to SQL Server, bit is a numeric datatype restricted to 0 and 1 (*). There has been several
discussions ion this group and .programming on the subject and I recommend that you check the
archives and determine whether you want to use bit or, for example, char(1) with a check constraint
restricting to 't' pr 'f', 'y' or 'n' etc (see the old discussions other options exists).
(*) One strange thing with the bit datatype in SQL Server is that you will not get an overflow if
you assign, for instance, the value 2 to a bit datatype. The result will be 1.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd
|||In addition to the other comments... When deciding whether to use bit or
char(1), you are (essentially) weighing the space savings of bit, versus the
ease of printing with a char(1)( no conversion on output)...
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
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no
> 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd
Boolean datatypes
How to create fields with boolean datatypes? There seems to be no 'boolean'
SQL data type. Can the bit datatype be used to store 0 for false and 1 for
true?
Thanks,
kdkd,
There are no boolean datatype in SQL Server 7/2000. You can use bit (or
another "numeric" datatype, tinyint for example) or use a char(1)
storing "F"/"T" (or "Y"/"N" or whatever). Bit is normally "converted" to
a boolean by ADO (but I'm not sure if bit=0 is TRUE or FALSE, I _think_
it "means" FALSE...).
Lars Broberg
Elbe-Data AB
http://www.elbe-data.se
Remove "nothing." when replying to private e-mail!
kd wrote:
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean
'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd|||You are correct that there is no Boolean datatype in SQL Server. You can cho
ose whatever you want to
represent what you want to call "true" and "false", these will only be value
s of that datatype for
SQL Server. Some programming environments will consider bit as Boolean and b
ind such automatically;
but to SQL Server, bit is a numeric datatype restricted to 0 and 1 (*). Ther
e has been several
discussions ion this group and .programming on the subject and I recommend t
hat you check the
archives and determine whether you want to use bit or, for example, char(1)
with a check constraint
restricting to 't' pr 'f', 'y' or 'n' etc (see the old discussions other opt
ions exists).
(*) One strange thing with the bit datatype in SQL Server is that you will n
ot get an overflow if
you assign, for instance, the value 2 to a bit datatype. The result will be
1.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no 'boolean
'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd|||In addition to the other comments... When deciding whether to use bit or
char(1), you are (essentially) weighing the space savings of bit, versus the
ease of printing with a char(1)( no conversion on output)...
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
"kd" <kd@.discussions.microsoft.com> wrote in message
news:3F70CFF6-3B66-497A-B2D0-5A98E9D6F597@.microsoft.com...
> Hi All,
> How to create fields with boolean datatypes? There seems to be no
> 'boolean'
> SQL data type. Can the bit datatype be used to store 0 for false and 1 for
> true?
> Thanks,
> kd
Boolean Data Type not available (workaround for checkbox.checked storing?)
I have a page for inventory price entry that I have used for a while. Now I need to add a checkbox for whether or not the price includes shipping. I added the checkbox to the form and had it posting 'True' or 'False' to the database as nchar(10) data type. When the gridview pulls up the data, I have the Item Template like this, so it shows a disabled checkbox either checked or not:
<asp:CheckBoxID="CheckBox2"runat="server"Checked='<%# Convert.ToBoolean(Eval("Shipping")) %>'Enabled="False"/>
This works fine for displaying the values, but I copied the checkbox to the Edit Item Template, but did not disabled this one. At first, I didn't change the databindings, leaving it Convert.ToBoolean(Eval("Shipping")), which allowed me to go into Edit mode, change the checkbox, then click update. At which point it would return to it's original state (meaning Update wasn't actually updating). However if I change the databindings, then the page won't display.
I checked the SQL statement, and sure enough, it has the
UpdateCommand="UPDATE [PartsTable] ... SET [Shipping] = @.Shipping... WHERE [PartID] = @.original_PartID
After fiddling with the sql statement, now I get Object cannot be cast from DBNull to other types. I think that means that the checkbox is sending a null value to the database.
Any insight as to how to get this to work is much appreciated. Thanks in advance.
I don't know if this will work declaratively but your problem is ANSI SQL Boolean is three valued True/False/Null the reason ANSI SQL is called three valued logic. The links below will show how to use Nullable types of FCL(framework class library) 2.0 to solve your problem. Hope this helps.
http://www.codeproject.com/csharp/c__20_nullable_types.asp
http://www.c-sharpcorner.com/UploadFile/PashuSX/NullableTypes04282006114548AM/NullableTypes.aspx?ArticleID=b28a5114-a92a-4ced-a23c-06d8a29de6e4
|||I found this thread:http://forums.asp.net/thread/1092916.aspx and after reading it, I've changed the data type in the database to Bit. This has significantly helped my problem .
BUT I have the checkbox in normal mode displaying perfectly fine. However, when I click edit, there is a textbox that displays either True or False (True is 1 and False is 0 in the database). If I change True to 0 or False to 1, it works. HOWEVER I want it to display a textbox. When I delete the textbox in the edit template, replace it with a checkbox and then set the databinding to the shipping field, I can click edit and the box appears just fine, but when I change it and click update, I get this Error:Syntax error converting the nvarchar value 'False' to a column of data type bit.Which to me means that it is trying to post the checkbox.checked ='s value, not just checkbox.checked which is stored as a bit in the database.
How/Where can I change this?
|||Figured it out! Turns out the auto generated update statement set the paramenter to<asp:ParameterName="Shipping"Type="String"/>
So I took out the Type="String" and it fixed my problem.
Thanks.
|||I am glad to see your problem is resolved.boolean data type
ThanksYou could use the bit datatype for this purpose. If the bit is always defined I think it even may save some space. However, if there are (possibly in the future) some procedures or external programs involved I'd stick to using int instead.
Boolean data type
boxes and radio buttons in a .net app to some columns in a SQL table and I
don't see any boolean data type. What should I do if I want to assign a data
type "boolean" to a table's column in SQL?
--
TSThere is not... Many developers use CHAR(1), with a check constraint
restricting the values to 'Y' or 'N'. Some people like to use BIT instead,
but I personally prefer the former approach...
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"TS" <TS@.discussions.microsoft.com> wrote in message
news:205D2093-75E3-49A5-B2EE-267113AF7ADB@.microsoft.com...
> Is there a boolean data type in SQL? I'm trying to bind a number of check
> boxes and radio buttons in a .net app to some columns in a SQL table and I
> don't see any boolean data type. What should I do if I want to assign a
> data
> type "boolean" to a table's column in SQL?
> --
> TS|||> Is there a boolean data type in SQL?
No, you probably want BIT, though it can take 0, 1, or false. Many people
use CHAR(1) and set a constraint to be either T/F or Y/N.
A|||Well, there is the BIT type. You could also just use a numeric field (of
some sort) and treat it as 0=FALSE, !0=TRUE.
I _think_ bit is preferable, because being a bit, it is either 0 or 1
(or -1, im not sure) and is therefore a logical boolean, but a plain numeric
is more portable if that is a concern.
HTH.
"TS" <TS@.discussions.microsoft.com> wrote in message
news:205D2093-75E3-49A5-B2EE-267113AF7ADB@.microsoft.com...
> Is there a boolean data type in SQL? I'm trying to bind a number of check
> boxes and radio buttons in a .net app to some columns in a SQL table and I
> don't see any boolean data type. What should I do if I want to assign a
> data
> type "boolean" to a table's column in SQL?
> --
> TS|||> No, you probably want BIT, though it can take 0, 1, or false.
Of course, I meant 0, 1, or NULL.|||Uh, oh. Now you're starting to think like SSMS :)
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:u$vi6Yt7FHA.2608@.TK2MSFTNGP10.phx.gbl...
> Of course, I meant 0, 1, or NULL.
>|||> Uh, oh. Now you're starting to think like SSMS :)
Nah, I would have put NULL in italics and spelled out 0 as "false" and 1 as
"true"... :-)|||There isn't a boolean type in SQL but you can use bit type.
If you want to assign a data type "boolean" to table column ( I assume that
column's name is Male), you can do
if chkMale.Checked =true then
insert into ... (PersonID, Name, Male) values ('P001','Richard',1)
else
insert into ... (PersonID, Name, Male) values ('P001','Richard',0)
end if
That's it.
"TS" wrote:
> Is there a boolean data type in SQL? I'm trying to bind a number of check
> boxes and radio buttons in a .net app to some columns in a SQL table and I
> don't see any boolean data type. What should I do if I want to assign a da
ta
> type "boolean" to a table's column in SQL?
> --
> TS
Monday, March 19, 2012
Body type not supported by Remote Host issue
lay to provide message filtering etc and SMTP command
scanning (such as it may be). This server relays to my internal SMTP server
which is an Exchange 5.5. Prior to this my Exchange
server received the email directly from the sending server with even less pr
otection by the ISA server. Since putting the 6.0
SMTP server in, I have been receiving (as admin) NDRs on in bound messages w
ith the error 'Body type not supported by Remote
Host'.
1) - I am not sure that these message really can't be handled by my 5.5. ser
ver. The reason I question this is that the NDR has
the original message as an attachment and I can open many of them in Outlook
that accesses the 5.5 server) and read them just
fine. Some of them are gibberish.
2) - I would really like the messages to continue on to the Exchange server
and let the chips fall as they may as they did before
I put the inbound relay was put in place.
3) - If I must have the NDR on the inbound messages, I would like to prevent
NDRs from being returned to the sender of these
messages. In fact, I think I could live without any NDRs returned to sender
from this relay. I have a 3 rd party spam filtering
service that discards messages to my domain for addresses without mailboxes
and my Exchange server should really provide what ever
other type of NDR that is required.
I saw an article about disabling 8bitmime advertising for Windows 2000 SMTP,
but I am not sure that it applies because
1) - I really expect the procedure is different.
2) - The rejected messages don't indicate an 8bitmime type
3) - MS did not provide an equivalent article for Server 2003
Any information about the error message Body type not supported by Remote Ho
st or suggests would be most appreciated.
Thanks
---
Roy Chastain
KMSystems, Inc.Sorry about the mis-post. My mousing skills seem to be getting worse with a
ge.
On Wed, 23 Jun 2004 08:04:37 -0400, Roy Chastain <roy@.kmsys.com> wrote:
>I have recently setup a 2003 server with ISA firewall and an inbound SMTP r
elay to provide message filtering etc and SMTP command
>scanning (such as it may be). This server relays to my internal SMTP serve
r which is an Exchange 5.5. Prior to this my Exchange
>server received the email directly from the sending server with even less p
rotection by the ISA server. Since putting the 6.0
>SMTP server in, I have been receiving (as admin) NDRs on in bound messages
with the error 'Body type not supported by Remote
>Host'.
>1) - I am not sure that these message really can't be handled by my 5.5. se
rver. The reason I question this is that the NDR has
>the original message as an attachment and I can open many of them in Outloo
k that accesses the 5.5 server) and read them just
>fine. Some of them are gibberish.
>2) - I would really like the messages to continue on to the Exchange server
and let the chips fall as they may as they did before
>I put the inbound relay was put in place.
>3) - If I must have the NDR on the inbound messages, I would like to preven
t NDRs from being returned to the sender of these
>messages. In fact, I think I could live without any NDRs returned to sende
r from this relay. I have a 3 rd party spam filtering
>service that discards messages to my domain for addresses without mailboxes
and my Exchange server should really provide what ever
>other type of NDR that is required.
>I saw an article about disabling 8bitmime advertising for Windows 2000 SMTP
, but I am not sure that it applies because
>1) - I really expect the procedure is different.
>2) - The rejected messages don't indicate an 8bitmime type
>3) - MS did not provide an equivalent article for Server 2003
>Any information about the error message Body type not supported by Remote H
ost or suggests would be most appreciated.
>Thanks
>---
>Roy Chastain
>KMSystems, Inc.
---
Roy Chastain
KMSystems, Inc.
Body type not supported by Remote Host issue
scanning (such as it may be). This server relays to my internal SMTP server which is an Exchange 5.5. Prior to this my Exchange
server received the email directly from the sending server with even less protection by the ISA server. Since putting the 6.0
SMTP server in, I have been receiving (as admin) NDRs on in bound messages with the error 'Body type not supported by Remote
Host'.
1) - I am not sure that these message really can't be handled by my 5.5. server. The reason I question this is that the NDR has
the original message as an attachment and I can open many of them in Outlook that accesses the 5.5 server) and read them just
fine. Some of them are gibberish.
2) - I would really like the messages to continue on to the Exchange server and let the chips fall as they may as they did before
I put the inbound relay was put in place.
3) - If I must have the NDR on the inbound messages, I would like to prevent NDRs from being returned to the sender of these
messages. In fact, I think I could live without any NDRs returned to sender from this relay. I have a 3 rd party spam filtering
service that discards messages to my domain for addresses without mailboxes and my Exchange server should really provide what ever
other type of NDR that is required.
I saw an article about disabling 8bitmime advertising for Windows 2000 SMTP, but I am not sure that it applies because
1) - I really expect the procedure is different.
2) - The rejected messages don't indicate an 8bitmime type
3) - MS did not provide an equivalent article for Server 2003
Any information about the error message Body type not supported by Remote Host or suggests would be most appreciated.
Thanks
Roy Chastain
KMSystems, Inc.
Sorry about the mis-post. My mousing skills seem to be getting worse with age.
On Wed, 23 Jun 2004 08:04:37 -0400, Roy Chastain <roy@.kmsys.com> wrote:
>I have recently setup a 2003 server with ISA firewall and an inbound SMTP relay to provide message filtering etc and SMTP command
>scanning (such as it may be). This server relays to my internal SMTP server which is an Exchange 5.5. Prior to this my Exchange
>server received the email directly from the sending server with even less protection by the ISA server. Since putting the 6.0
>SMTP server in, I have been receiving (as admin) NDRs on in bound messages with the error 'Body type not supported by Remote
>Host'.
>1) - I am not sure that these message really can't be handled by my 5.5. server. The reason I question this is that the NDR has
>the original message as an attachment and I can open many of them in Outlook that accesses the 5.5 server) and read them just
>fine. Some of them are gibberish.
>2) - I would really like the messages to continue on to the Exchange server and let the chips fall as they may as they did before
>I put the inbound relay was put in place.
>3) - If I must have the NDR on the inbound messages, I would like to prevent NDRs from being returned to the sender of these
>messages. In fact, I think I could live without any NDRs returned to sender from this relay. I have a 3 rd party spam filtering
>service that discards messages to my domain for addresses without mailboxes and my Exchange server should really provide what ever
>other type of NDR that is required.
>I saw an article about disabling 8bitmime advertising for Windows 2000 SMTP, but I am not sure that it applies because
>1) - I really expect the procedure is different.
>2) - The rejected messages don't indicate an 8bitmime type
>3) - MS did not provide an equivalent article for Server 2003
>Any information about the error message Body type not supported by Remote Host or suggests would be most appreciated.
>Thanks
>---
>Roy Chastain
>KMSystems, Inc.
Roy Chastain
KMSystems, Inc.
Bocking Issue
trans = 0, command = select, status is runnable, wait time
of around 70000000. application is IIS.
I'm assuming I can just kill this spid beceause it's
a "select" and not part of a transaction. Is there some
way to tell if it's safe to kill this?Did you do a DBCC INPUTBUFFER on that spid? That'll at least tell you what
exactly that spid is selecting, and you could determine, where that
connection is coming from.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"maryann" <anonymous@.discussions.microsoft.com> wrote in message
news:0bcf01c3d53c$b61fb070$a501280a@.phx.gbl...
I have a spid that has a wait type of networkio, open
trans = 0, command = select, status is runnable, wait time
of around 70000000. application is IIS.
I'm assuming I can just kill this spid beceause it's
a "select" and not part of a transaction. Is there some
way to tell if it's safe to kill this?
blog select with comment count
select
a.id, b.textField
count(b.a_id) as myCount
from a left join b on a.id = b.a_id
group by a.id, b.textField
What other methods could i use to get "myCount" within one sql statement?
Thanks in advance, JeffHere is more information:
using sql server 2000 (from asp.net) the following sql works great when the "textForm" field is of type nvarchar but doesn't work for the text type.
I don't believe nvarchar will work for my needs since it is limited to 8000 (4000 due to double storage). I believe I will need to use the text type.
select bm.message_id,
bm.title,
bm.display_date,
bm.message,
count(bc.comment_id) as commentCount
from blog_messages as bm LEFT JOIN blog_comments as bc
on bm.message_id = bc.message_id
where bm.active_flag = 1
group by bm.message_id, bm.title, bm.display_date, bm.message
order by display_date DESC
The purpose of the select statement is to display a list of blog entries that includes the number of comments on each entry. An example of this in cold fusion is found at
http://www.camdenfamily.com/morpheus/blog/
With my limited knowledge of the asp.net repeater control, I'm not sure how to integrate 2 select statements (1st for blog content, 2nd for comment count). It seems the fastest way to get all of the information I want is to use a stored procedure using either a temp table or a cursor to compile all of the data together. However this method may forcee me to select the count from table b for each record of table a which could be time consuming.
Is there any way to achieve this goal with one select using the union statement or another type of join?
Although this might be a better sql question, I am also wondering about alternative asp.net solutions including repeaters with 2 or more select statements or using an array or list.|||How about something like:
select a.id,
b.textField,
myCount = (select count(*) from b where a_id = a.id)
from a
You might need to include a COALESCE function around the correlated subquery to check for NULL and send back a zero.|||it worked! thanks!
select bm.message_id,
bm.title,
bm.display_date,
bm.message,
commentCount = (select count('x')
from blog_comments as bc
where bc.message_id = bm.message_id)
from blog_messages as bm
where bm.active_flag = 1
order by bm.display_date DESC
Sunday, March 11, 2012
blocking prevent maintenance to run
that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
users in the db prior to running the DBCC DBREINDEX that is done during the
night. Granted I could do a DBCC INDEXDEFRAG for online.
I see the application causing the problem. They have confirmed that some
users are leaving reports open that are bound to data, which I assume is
causing the issue.
1. Is it possible to selectively kill the process that is causing the block
as to kill all users in the db?
I am open to ideas how to address the issue. How to battle being forced to
implement a server side bandaid to a application issue.Look up Alter Database in BOL. See the restricted_user and single_user
options with Rollback Immediate.
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:OJJRZhzdFHA.612@.TK2MSFTNGP12.phx.gbl...
>I am having intermittent issues with a team that has an Access front end
>that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
>users in the db prior to running the DBCC DBREINDEX that is done during the
>night. Granted I could do a DBCC INDEXDEFRAG for online.
> I see the application causing the problem. They have confirmed that some
> users are leaving reports open that are bound to data, which I assume is
> causing the issue.
> 1. Is it possible to selectively kill the process that is causing the
> block as to kill all users in the db?
> I am open to ideas how to address the issue. How to battle being forced
> to implement a server side bandaid to a application issue.
>
blocking prevent maintenance to run
that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
users in the db prior to running the DBCC DBREINDEX that is done during the
night. Granted I could do a DBCC INDEXDEFRAG for online.
I see the application causing the problem. They have confirmed that some
users are leaving reports open that are bound to data, which I assume is
causing the issue.
1. Is it possible to selectively kill the process that is causing the block
as to kill all users in the db?
I am open to ideas how to address the issue. How to battle being forced to
implement a server side bandaid to a application issue.
Look up Alter Database in BOL. See the restricted_user and single_user
options with Rollback Immediate.
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:OJJRZhzdFHA.612@.TK2MSFTNGP12.phx.gbl...
>I am having intermittent issues with a team that has an Access front end
>that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
>users in the db prior to running the DBCC DBREINDEX that is done during the
>night. Granted I could do a DBCC INDEXDEFRAG for online.
> I see the application causing the problem. They have confirmed that some
> users are leaving reports open that are bound to data, which I assume is
> causing the issue.
> 1. Is it possible to selectively kill the process that is causing the
> block as to kill all users in the db?
> I am open to ideas how to address the issue. How to battle being forced
> to implement a server side bandaid to a application issue.
>
blocking prevent maintenance to run
that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
users in the db prior to running the DBCC DBREINDEX that is done during the
night. Granted I could do a DBCC INDEXDEFRAG for online.
I see the application causing the problem. They have confirmed that some
users are leaving reports open that are bound to data, which I assume is
causing the issue.
1. Is it possible to selectively kill the process that is causing the block
as to kill all users in the db?
I am open to ideas how to address the issue. How to battle being forced to
implement a server side bandaid to a application issue.Look up Alter Database in BOL. See the restricted_user and single_user
options with Rollback Immediate.
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:OJJRZhzdFHA.612@.TK2MSFTNGP12.phx.gbl...
>I am having intermittent issues with a team that has an Access front end
>that hits SQL2000sp3a+. They are wanting me to do some type of kill of all
>users in the db prior to running the DBCC DBREINDEX that is done during the
>night. Granted I could do a DBCC INDEXDEFRAG for online.
> I see the application causing the problem. They have confirmed that some
> users are leaving reports open that are bound to data, which I assume is
> causing the issue.
> 1. Is it possible to selectively kill the process that is causing the
> block as to kill all users in the db?
> I am open to ideas how to address the issue. How to battle being forced
> to implement a server side bandaid to a application issue.
>
Saturday, February 25, 2012
blob data type in SQL Express
Hi all,
I am trying to store binary datafiles into a SQl Express table. However I can not find the BLOB data type when I am designing the table. Are we limited to using that kind of data type in the Express edition? Thanks.
Ke
hi Ke,
if you are searching for a BLOB datatype, you'll miss it..
SQLExpress does support blobs in different formats, binary, varbinary, image and text/ntext as long as the new datatypes as varchar(MAX), nvarchar(MAX), varbinary(MAX), XML
use tempdb;GO
CREATE TABLE dbo.testBlob (
Id int NOT NULL PRIMARY KEY,
b varchar(max),
i image,
b2 varbinary (50)
);
GO
DROP TABLE dbo.testBlob ;
I've just run SQL Server Management Studio Express, the official graphical client tool for SQLExpress, available for free download at http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en, and the relative datatypes are listed in the datatypes combobox when editing tables...
please have a look at http://msdn2.microsoft.com/en-us/library/ms187752.aspx for all supported data types..
regards
Friday, February 10, 2012
Bit type parameter for stored procedure
The syntax I am trying to use is:
MyStoredProcedure.Parameters.Add(New SqlParameter("@.Pdi",SqlDbtype.bit))
MyStoredProcedure.Parameters("@.pdi").value = -1
When I do my ExecuteNonQuery I get error 8114
What am I doing wrong?The bit data type can hold one of the following values: 1, 0, or NULL. You cannot store a -1 in a bit column.
Terri|||Ok thanks for that. It will indeed accept 1 or 0
I now need to use the value from a CheckBox type control on my Form. So now
My Code reads:
MyStoredProcedure.Parameters.Add(New SqlParameter("@.Pdi",SqlDbtype.bit))
MyStoredProcedure.Parameters("@.pdi").value = pdi.value
This generates the Error: "String was not recognised as a valid boolean."
What is the syntax for casting to a bit type value?|||You will likely need to convert your string value to a boolean value, using the ToBoolean method, something like this:
MyStoredProcedure.Parameters("@.pdi").value = System.Convert.ToBoolean(pdi.value)
See this article with handy chart for reference:Accessing SQL Server Data in C# with ADO.NET.
Terri|||No that didn't work either.
Just for the hell of it I decided to put the value of the PDI control into a span control like this:
message.innerhtml=pdi.value
I expected to see True or False or 1 or 0 or something. What I got was S00817
What is that!! I'm obviosly going the wrong way about extracting the value from a CheckBox control|||We might need to see more of your code.
Are you using a CheckBox or a CheckBoxList?
If a CheckBox, then it would probably be pdi.Checked, which already returns a boolean value.
I am sorry to be giving you the answer in pieces.
Terri|||Hi,
You need to use:
MyStoredProcedure.Parameters.Add(New SqlParameter("@.Pdi",SqlDbtype.bit))
MyStoredProcedure.Parameters("@.pdi").value = pdi.checked
or unchecked.
HTH
JB|||Yes that fixed it.
MyStoredProcedure.Parameters("@.pdi").value = pdi.checked
Thanks for your help|||
my check box is in the datagrid. I used this line. it have error.
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@.p_PDA", System.Data.SqlDbType.Bit, "PDA")).Value = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked
Here is my html code. I tried to assign the check box value to byte. It did not work, too. Thanks.
<asp:datagrid id="dtgPhysician" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 88px" runat="server" Font-Names="Arial" OnCancelCommand="dtgPhysician_Cancel" OnEditCommand="dtgPhysician_Edit" Width="985px" AutoGenerateColumns="False" PagerStyle-Mode="NumericPages" DataKeyField="License" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ShowHeader="true" EditItemStyle-BackColor="#eeeeee" BackColor="White" OnUpdateCommand="dtgPhysician_Update">
<SelectedItemStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedItemStyle>
<EditItemStyle BackColor="#EEEEEE"></EditItemStyle>
<AlternatingItemStyle BorderColor="#C0C0FF"></AlternatingItemStyle>
<ItemStyle ForeColor="#003399" BackColor="White"></ItemStyle>
<HeaderStyle Font-Size="Medium" Font-Names="Arial Black" Font-Bold="True" HorizontalAlign="Center" ForeColor="#CCCCFF" VerticalAlign="Middle" BackColor="#003399"></HeaderStyle>
<FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
<Columns>
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit Info"></asp:EditCommandColumn>
<asp:BoundColumn DataField="PName" SortExpression="PNAME asc" ReadOnly="True" HeaderText="Name" HeaderStyle-Font-Name="arial">
<HeaderStyle Font-Names="arial"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Status") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList runat="server" id="lstStatus" DataTextField="Status" SelectedIndex ='<%# GetSelIndex(Container.DataItem("Status")) %>'>
<asp:ListItem Value="0">DOC</asp:ListItem>
<asp:ListItem Value="1">POE</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Group">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "PGroup") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtGroup" Width="100%" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "PGroup") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Email") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtEmail" Width="100%" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Email") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Logon">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "LogonName") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtLogon" Width="100%" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LogonName") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="PDA">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "PDA") %>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox id="ckPDA" runat="server" Checked ='<%# DataBinder.Eval(Container.DataItem, "PDA") %>'>
</asp:CheckBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Training">
<EditItemTemplate>
<asp:DropDownList runat="server" id="dpTraining">
<asp:ListItem Value="0">Init Training</asp:ListItem>
<asp:ListItem Value="1">Retraining</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Date">
<EditItemTemplate>
<asp:textbox runat="server" id="txtDate"></asp:textbox>
<asp:CompareValidator id="vrDate" runat="server" ErrorMessage="*date*" ControlToValidate="txtDate" Type="Date" Operator="DataTypeCheck"></asp:CompareValidator>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="PID" SortExpression="PID" ReadOnly="True" HeaderText="Physician ID">
<HeaderStyle Font-Names="arial"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#003399" Position="Top" BackColor="#99CCCC" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
yan19454:
I used this line. it have error.
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@.p_PDA", System.Data.SqlDbType.Bit, "PDA")).Value = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked
Please please please always post the error encountered, not just the fact that you have an error.
Bit or character data type?
SP4
Im creating a DB that has several Bit coulmns. The data is coming from a
mainframe. When one stored proc is run, the result set needs to have a "y",
an "n", or a " '' " (space) as thats the way current systems work. Another
proc needs to return "Eligible" or "Not eligible". I had originally thought
of using a Bit fields, but now I'm wondering why. It seems to me that if I
use Bit, I then need to convert it to display one of the things just listed.
Whereas if I use character coulmns and add check constraints to the to make
sure only certain values can be added, that conversion doesnt need to occur
when the data is being retrieved from the DB. Id have to imagine Im not the
first one to think of this as no app will probably ever return a 1 or a 0, s
o
Im wondering what others thoughts on the matter are?A couple of things to consider, a bit column by itself takes up one byte.
If eight of them are together in a table you can save some space. To put
"Not eligible" takes 12 or 14 bytes depending on char or varchar. Next bit
has a special behavior that says any integer other than 0 is 1. In the end
I like to format results in the reporting tool so I would generally choose a
tinyint with a check constraint. But in the case of 'y', 'n', or space
char(1) would be pretty effective.
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:57F596FC-365B-4EF5-907E-041498A0D11B@.microsoft.com...
> SQL2K
> SP4
> Im creating a DB that has several Bit coulmns. The data is coming from a
> mainframe. When one stored proc is run, the result set needs to have a
> "y",
> an "n", or a " '' " (space) as thats the way current systems work. Another
> proc needs to return "Eligible" or "Not eligible". I had originally
> thought
> of using a Bit fields, but now I'm wondering why. It seems to me that if I
> use Bit, I then need to convert it to display one of the things just
> listed.
> Whereas if I use character coulmns and add check constraints to the to
> make
> sure only certain values can be added, that conversion doesnt need to
> occur
> when the data is being retrieved from the DB. Id have to imagine Im not
> the
> first one to think of this as no app will probably ever return a 1 or a 0,
> so
> Im wondering what others thoughts on the matter are?|||Chris,
Eight or less bit columns willl occupy only one byte, therefore the bit type
should be the prefered choice if you have multiple such columns in the same
table. From SQL Server books on-line:
"Microsoft SQL ServerT optimizes the storage used for bit columns. If there
are 8 or fewer bit columns in a table, the columns are stored as 1 byte. If
there are from 9 through 16 bit columns, they are stored as 2 bytes, and so
on."
http://msdn.microsoft.com/library/d...br />
2it0.asp
Leo
"Danny" <nomailbox@.nowhere.com> wrote in message
news:Uiqfg.13100$lN5.1551@.trnddc04...
>A couple of things to consider, a bit column by itself takes up one byte.
>If eight of them are together in a table you can save some space. To put
>"Not eligible" takes 12 or 14 bytes depending on char or varchar. Next bit
>has a special behavior that says any integer other than 0 is 1. In the end
>I like to format results in the reporting tool so I would generally choose
>a tinyint with a check constraint. But in the case of 'y', 'n', or space
>char(1) would be pretty effective.
> "ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
> news:57F596FC-365B-4EF5-907E-041498A0D11B@.microsoft.com...
>