Showing posts with label number. Show all posts
Showing posts with label number. Show all posts

Tuesday, March 27, 2012

Boolean data type

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?
--
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

Sunday, February 19, 2012

Blank rows on report

Hello,
My report seems to be generrating a randon number of rows per page. Some
pages have only one row, others three and some blank. this does not appear
to correspond to group breaks. Has anyone else seen this? Is there a way to
make the report rows follow immediately one after another?
Thanks.HI jo st charles,
i encountered the same problem because of the improper groupings onli.
u can check the same.
check out the detail cell u can find some more.if u can give out some more
info
i will help u out.
cheers
drupa

Friday, February 10, 2012

bit off topic: street name database US

I'm thinking of doing some basic parsing of address. I want to seprate
out the house number from the street name from the suffix. I have the
suffix's from the USPS, but I cant find a database of US street names.
Anyone come across one or know where I can get one?
TIA
Rob
/end off topic"rcamarda" <rcamarda@.cablespeed.com> wrote in message
news:1127439693.974508.70290@.o13g2000cwo.googlegro ups.com...
> I'm thinking of doing some basic parsing of address. I want to seprate
> out the house number from the street name from the suffix. I have the
> suffix's from the USPS, but I cant find a database of US street names.
> Anyone come across one or know where I can get one?
> TIA
> Rob
> /end off topic

Its probably not in a convenient format, but you could try parsing
streetnames from TIGER data - www.census.gov/geo/www/tiger/index.html. TIGER
data is used by a lot of applications and is free. They might do a separate
street name download, but I couldn't get to the site when I tried just now
to look.

Hope this is useful.
--
Brian Cryer
www.cryer.co.uk/brian|||Brian,
That did the trick, thanks! I found the detail files in Tiger located
here: http://www.census.gov/geo/www/tiger.../tgr2004se.html
I used GETRIGHT to download all the zip files (over 1,600). There is a
ton of data that I dont need, ill just use SQL to keep the unique
street names. I plan to get all the unique street names and all the
street suffixes. If anyone is interested in the data when I'm done,
post and I'll send you the info.

After I get all the text data loaded, my next step will be parse out
the addresses, so I'm sure I'll be posting in this group again!

Cheers,
Rob