Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Tuesday, March 27, 2012

binding textbox text to a database field

hello

is it possible to to bind a single field from a database table to a textbox.

I am trying to open a web form with five textboxes on it. When it loads is it possible to have the textboxes filled with a different field from a row in a database, selected with a sql statment.

Thanks in advance NubNub

Wrong Forum.|||

Yes, that is quite possible.

But you will get better assistance if you post your question in one of the .NET ASP related forums.

sql

Binding last row in table to a label

Hi all. I have a label on my page and I want to bind it to a field in a table. The catch is that I want to bind it to the last row in the table. I think I can use the custom binding, but I don't know how to bind to the last row. Any Suggestions ?

p.s. The page is tied to an SqlDataSource that retrieves the data from the above table.

Thanks in advance.

Could you not change the datasource to only return the last row? Or did you want all the other rows as well?

What about

Label1.text = dt.Rows(dt.Rows.Count-1)("FieldName").ToString()

where dt is the datatable containing the data you are binding to.

|||

Thanks for the reply GavDraper,

but what is the type of dt, how can I use a sql server table in my code ? and what is the meaning of "FieldName" ?

|||

the type of dt is datatable. You would need to replace fieldname with the name of the field you want to pull data from. below is a very rough quick example although I'm unable to test this as im not at my development machine, you would also want to include some error handling

dim dt as new datatable()dim sqlCon as new sqlConnection(strCon)dim sqlAdp as new SqlDataAdapter()sqlAdp.SelectCommand.Connection = sqlCon()
sqlAdp.Selectcommand.CommandText ("SELECT * FROM tablename")sqlAdp.fill(dt)lbl1.Text = dt.Rows(dt.Rows.Count-1)("FieldName")
|||

I'll give it a try,

but is it possible to do it without the code behind ?

I have the label and I use databinding to bind the fields in the table using the sqldatasource, but somehow it gives me the first row in the table.

I use a stored procedure to select the data from the table and use parameters in that stored procedure. So is it possible to bind to these parameters declaratively so they would give me the fields in the last row ?

The stored procedure:

CREATE PROCEDURE dbo.createPage@.PageTitlenvarchar(300)OUTPUT, @.PageMetaDescnvarchar(300)OUTPUT,@.PageMetaWordsnvarchar(300)OUTPUT,@.PageDescnvarchar(300)OUTPUT,@.PageTemplateint OUTPUTASDECLARE @.pIdAS intSELECT @.pId =cast(SCOPE_IDENTITY()AS int)--selecting the id of the last row inserted--selecting the data from that rowSELECT PageTitle,PageMetaDesc,PageMetaWords,PageDesc,PageHTML, PageTemplate, PageSummaryHTMLFROM PagesWHERE PageId = @.pIdGO
 
|||

that stored procedure is returning the data in no particular order how can you be sure its always the last record you want? You could change the stored procedure to only return 1 record by using the TOP keyword but to make this accurate the data would have to be ordered to guarentee you will always get the correct row.

Binding Different DataSets to One Table.

I have a situation where i am binding a Dataset Dset1 to a table.
, I also have a Dset2 which i am not binding. Now as the Rows gets
rendered depending on Dset1 i also want to populate a value from Dset2
(2nd Datset ) in a cell for a particular Row.
How do i do that?
Any help.
ThanksYou cannot bind a data region (in this case a table) to more than one
dataset. You should re-design the report so that it has one dataset that has
a query returning both the data currently in Dset1 and in Dset2. This will
most likely mean writing a JOIN SQL query.
Charles Kangai, MCDBA, MCT
"Rahul" wrote:
> I have a situation where i am binding a Dataset Dset1 to a table.
> , I also have a Dset2 which i am not binding. Now as the Rows gets
> rendered depending on Dset1 i also want to populate a value from Dset2
> (2nd Datset ) in a cell for a particular Row.
>
> How do i do that?
> Any help.
>
> Thanks
>|||That is easier to to in a store proc, identifying to temp tables and
populating your row in there - and THEN returning one data-set back to the
report server.
"Rahul" wrote:
> I have a situation where i am binding a Dataset Dset1 to a table.
> , I also have a Dset2 which i am not binding. Now as the Rows gets
> rendered depending on Dset1 i also want to populate a value from Dset2
> (2nd Datset ) in a cell for a particular Row.
>
> How do i do that?
> Any help.
>
> Thanks
>

binding COUNT

hi guys,

i want to count the number of times a particular data occurs in a table and display that data in a listbox

initially i planned to count the number of occurrences and bind that number to a variable for further manipulation but i have no idea how to do the binding part

how do i solve this?

thanx

Are you trying to update a db column that contains the count? If you're trying to do that, you could use a trigger or daily/nightly processing to do this based on how often you want it updated, how frequently the table is accessed, etc. If you're trying to do it in code, you could just set your variable equal to "select count ... where..." and mess with it in the code.

Thanks,
Sam Lester (MSFT)

|||

thanx sam!

Binding a DataSource Table column to a form object (RadioButtons)

Hi,

I have a little question. I have an application which interfaces with a SQL Express Database. On a form, I want to bind a control which is made of several Radio buttons to a table column which is in fact a varchar(1). This is the picture:

Table column: OptVisualRpt varchar(1)

Screen control: 2 radio buttons

rb_VisRPTbImp_O for "yes"

rb_VisRPTbImp_N for "no"

I'm really scratching my head as how I can bind a single table column to my radio buttons controls. I think that I just can't this way but rather have to use an intermediate variable or control.

Solution 1?

I thought of using a local variable that I would set to "y" or "n" following "CheckedChanged" events fired from radio buttons but I don't know how to bind this variable to my table column.

Solution 2?

I thought of placing a hidden text control into my form, which one would be binded to my table column, that I would also set to "y" or "n" following "CheckedChanged" events fired from radio buttons.

Any of these solutions which would be feasible or any more neat way to do it?

Many thanks in advance,

Stphane

Hi again,

Finally sounds that last night I could solve my problem by myself. Let me explain.

1- I first got rid of the "Binding source". I removed following lines:

=> private: System::Windows::Forms::BindingSource ^ InfoBaseBindingSource;

=> this->InfoBaseBindingSource = (gcnew System::Windows::Forms::BindingSource(this->components));

=> (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->InfoBaseBindingSource))->BeginInit();

=> //
// InfoBaseBindingSource
//

this->InfoBaseBindingSource->DataMember = L"InfoBase";
this->InfoBaseBindingSource->DataSource = this->Test_ADODataSet;

=> (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->InfoBaseBindingSource))->EndInit();

2- At the same time, for every field control that were fed by it, I removed from code the following line (here is an example):

this->ID_Compagnie->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->InfoBaseBindingSource, L"Identification", true)));

3- I then changed the Form1_Load routine for the following:

this->InfoBaseTableAdapter->Fill(this->Test_ADODataSet->InfoBase);

DataTable ^ Dt_Infobase = this->Test_ADODataSet->Tables["InfoBase"];
if(Dt_Infobase != nullptr)
{
array<DataRow^> ^ Rw_InfoBase = Dt_Infobase->Select();
if(Rw_InfoBase->Length != 0)
{
this->ID_Compagnie->Text = Rw_InfoBase[0]["Identification"]->ToString();
this->Adr_Compagnie->Text = Rw_InfoBase[0]["Adresse"]->ToString();
...

==> Example of loading a masked text box

// Affichage et rectification du format du Code Postal/ZipCode

if(String::Compare(this->Pays_Compagnie->Text,"Canada") == 0)
{
this->CPZip_Compagnie->Mask = ">L0>L 0>L0";
this->Pnl_VSZCode->Hide();
}
else
{
this->Pnl_VSZCode->Show();
if(this->CPZip_Compagnie->Text->Length > 5)
{
this->VScrl_ZCode->Value = 1;
this->CPZip_Compagnie->Mask = "99999";
}
else
{
this->VScrl_ZCode->Value = 0;
this->CPZip_Compagnie->Mask = "99999-9999";
}
}

this->CPZip_Compagnie->Text = Rw_InfoBase[0]["CodePostal_Zip"]->ToString();

...

==> Example of "loading" info vs a set of radio buttons

String ^ Logo_ModeAff = Rw_InfoBase[0]["LogoRpt_ModeAff"]->ToString();
if(Logo_ModeAff == "C")
{
this->rb_ModeAffLCoord->Checked = true;
this->rb_ModeAffLOnly->Checked = false;
}
else
{
this->rb_ModeAffLCoord->Checked = false;
this->rb_ModeAffLOnly->Checked = true;
}
}

4- I then changed the B_Accept_Click routine for the following:

I removed following sentences:

this->InfoBaseBindingSource->EndEdit();
this->InfoBaseTableAdapter->Update(this->Test_ADODataSet->InfoBase);
this->Test_ADODataSet->AcceptChanges();

And replaced them with following:

DataTable ^ Dt_Infobase = this->Test_ADODataSet->Tables["InfoBase"];
if(Dt_Infobase != nullptr)
{
array<DataRow^> ^ Rw_InfoBase = Dt_Infobase->Select();
if(Rw_InfoBase->Length == 0)
{
DataRow ^ NRw_InfoBase = Dt_Infobase->NewRow();

NRw_InfoBase["Identification"] = this->ID_Compagnie->Text;
...
==> Example of a "saving" info vs a set of radio buttons

if(this->rb_ModeAffLCoord->Checked == true)
NRw_InfoBase["LogoRpt_ModeAff"] = "C";
else
NRw_InfoBase["LogoRpt_ModeAff"] = "L";
...

Dt_Infobase->Rows->Add(NRw_InfoBase);
}
else
{
Rw_InfoBase[0]["Identification"] = this->ID_Compagnie->Text;
...
==> Example of a "replacing" info vs a set of radio buttons

if(this->rb_ModeAffLCoord->Checked == true)
Rw_InfoBase[0]["LogoRpt_ModeAff"] = "C";
else
Rw_InfoBase[0]["LogoRpt_ModeAff"] = "L";
...
}

this->InfoBaseTableAdapter->Update(this->Test_ADODataSet);
this->Test_ADODataSet->AcceptChanges();
}

5- I finally changed the B_Cancel_Click routine for the following:

I removed following sentences:

this->InfoBaseBindingSource->EndEdit();

This code is maybe not the best way to do it. If someone has any more proper way to do it, I would certainly appreciate to learn. My conclusion is that doing this binding process manually gives better results than relying on a BindingSource object.

Stphane

Sunday, March 25, 2012

bind matrix or table to image or map

Hi
I want to create a report where data is fixed to certain areas on a map (eg
I have an image of Switzerland and regional data. The data should be
displayed ontop of certain regions of the map). When I deploy the report and
open it in Preview or with a browser, everything is moved: eg, if I scroll up
or down, the data moves but the map stays fix.
Is there a way to tie the dataobjects to the image so the data will always
stay ontop of the same point?
Thanks for any help,
SalvatoreYou can approximate this by placing the data regions in rectangles and
placing rectangles in specific areas you'd like.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Salvatore" <Salvatore@.discussions.microsoft.com> wrote in message
news:B2DE92AB-4D79-4E6F-AB4F-A53FEA25CC9B@.microsoft.com...
> Hi
> I want to create a report where data is fixed to certain areas on a map
(eg
> I have an image of Switzerland and regional data. The data should be
> displayed ontop of certain regions of the map). When I deploy the report
and
> open it in Preview or with a browser, everything is moved: eg, if I scroll
up
> or down, the data moves but the map stays fix.
> Is there a way to tie the dataobjects to the image so the data will always
> stay ontop of the same point?
> Thanks for any help,
> Salvatore|||Hi Ravi
I have try by placing the data regions in rectangles or placing Image in
rectangles but without success
Thanks for any help,
Salvatore
"Ravi Mumulla (Microsoft)" wrote:
> You can approximate this by placing the data regions in rectangles and
> placing rectangles in specific areas you'd like.
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Salvatore" <Salvatore@.discussions.microsoft.com> wrote in message
> news:B2DE92AB-4D79-4E6F-AB4F-A53FEA25CC9B@.microsoft.com...
> > Hi
> > I want to create a report where data is fixed to certain areas on a map
> (eg
> > I have an image of Switzerland and regional data. The data should be
> > displayed ontop of certain regions of the map). When I deploy the report
> and
> > open it in Preview or with a browser, everything is moved: eg, if I scroll
> up
> > or down, the data moves but the map stays fix.
> >
> > Is there a way to tie the dataobjects to the image so the data will always
> > stay ontop of the same point?
> >
> > Thanks for any help,
> > Salvatore
>
>

Bind Image Data to PictureBox

Hi,
I'm just starting w/ VB.NET and want to find out how to bind an image from a
field in a SQL Server database table to a PictureBox control. I am able to
get data from the database into text boxes, etc., and to navigate and query
to different records, but coming from the Access world, I'm not sure how to
get image data displayed. We want to scan a document (single page), and sav
e
it with it's related record and just be able to view it in a Windows Form.
I've tried a few things that haven't worked and would really appreciate some
help!
--
PaulJS(This problem should be posted in a .NET Group)
For the example of o picturebox you should go along like this (picturebox).
Binding myBind = myPBox.DataBindings.Add("Image", myDataTable,
myDataColumn);
myBind.Format += new ConvertEventHandler(FormatImageData);
private void FormatImageData(object sender, ConvertEventArgs e)
{
if (e.DesiredType == typeof(Image))
{
System.Byte[] bytes = e.Value as Byte[];
System.IO.MemoryStream stream
= new System.IO.MemoryStream(bytes);
System.Drawing.Image image
= System.Drawing.Image.FromStream(stream);
stream.Close();
// Re-assign formatted data
e.Value = image;
}
}
HTH, Jens Suessmeyer.

Bind a Table to a StoredProcedure

Hi All
I am an RS Newbie - Please be gentle :-))
I have a table on an RS report
When the table is bound to a simple Select statement EG select * from
Customers
I can then further bind each control on the report to a field in the
recordset.
EG I select the relevant text box - then from the property sheet I select
from the list of available fields
in the 'Value' combo box on the property sheet
EG txtCustomer value in the property sheet = Fields!CustomerName.Value
Cool
But when I change the recordset for the table to a Stored Proc
I see no available fields when I select a Text box and try to bind it to a
value in the propertyy sheet
Infact rather than a list of available fields, all I can see is <Expression>
Don't know where to go from here - any suggestions appreciated
Many thanks
DenzilSometimes when you switch to a stored procedure it does not detect the field
list. Try the following. Hopefully one of these two will do the trick.
1. in the dataset view click on the refresh fields button (it is to the
right of the ... and looks like the refresh button from IE
2. Make sure the command type is stored procedure and just put in the name
of the stored procedure like this: MyStoredProcName
Not like this: Exec MyStoredProcName
After doing this then try #1 again.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Denzil" <u18940@.uwe> wrote in message news:5c3160a2829f0@.uwe...
> Hi All
> I am an RS Newbie - Please be gentle :-))
> I have a table on an RS report
> When the table is bound to a simple Select statement EG select * from
> Customers
> I can then further bind each control on the report to a field in the
> recordset.
> EG I select the relevant text box - then from the property sheet I select
> from the list of available fields
> in the 'Value' combo box on the property sheet
> EG txtCustomer value in the property sheet = Fields!CustomerName.Value
> Cool
> But when I change the recordset for the table to a Stored Proc
> I see no available fields when I select a Text box and try to bind it to a
> value in the propertyy sheet
> Infact rather than a list of available fields, all I can see is
> <Expression>
> Don't know where to go from here - any suggestions appreciated
> Many thanks
> Denzil|||Hi Bruce
Many thanks for the swift reply
When I read the bit about changing the command type I thought that would be
it
But...sorry none of this worked <sigh>
When I change the Command Type to StoredProc and remove the 'exec' at the
front of the
query string then try and run it - it errors out and does not give me the
expected popup box where I would manually enter any parameters
The error is
"An error occurred whilst trying to retrieve the parameters in the query
rsGetAccountList @.ActiveStatus does not exist"
before, I used to have "exec rsGetAccountList @.ActiveStatus" in the dataset
view and had the command type as Text. With that setup I could run the query
in DataSet view and get my parameter popup box
Any more suggestions? :-))
Many thanks
Denzil
Bruce L-C [MVP] wrote:
>Sometimes when you switch to a stored procedure it does not detect the field
>list. Try the following. Hopefully one of these two will do the trick.
>1. in the dataset view click on the refresh fields button (it is to the
>right of the ... and looks like the refresh button from IE
>2. Make sure the command type is stored procedure and just put in the name
>of the stored procedure like this: MyStoredProcName
>Not like this: Exec MyStoredProcName
>After doing this then try #1 again.
>> Hi All
>> I am an RS Newbie - Please be gentle :-))
>[quoted text clipped - 23 lines]
>> Denzil|||Did you put this? rsGetAccountList @.ActiveStatus
If so, remove th @.ActiveStatus. Just put the name of the stored procedure.
RS automatically retrieves the parameter list from the stored procedure.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Denzil" <u18940@.uwe> wrote in message news:5c319c74a8f20@.uwe...
> Hi Bruce
> Many thanks for the swift reply
> When I read the bit about changing the command type I thought that would
> be
> it
> But...sorry none of this worked <sigh>
> When I change the Command Type to StoredProc and remove the 'exec' at the
> front of the
> query string then try and run it - it errors out and does not give me the
> expected popup box where I would manually enter any parameters
> The error is
> "An error occurred whilst trying to retrieve the parameters in the query
> rsGetAccountList @.ActiveStatus does not exist"
> before, I used to have "exec rsGetAccountList @.ActiveStatus" in the
> dataset
> view and had the command type as Text. With that setup I could run the
> query
> in DataSet view and get my parameter popup box
> Any more suggestions? :-))
> Many thanks
> Denzil
>
> Bruce L-C [MVP] wrote:
>>Sometimes when you switch to a stored procedure it does not detect the
>>field
>>list. Try the following. Hopefully one of these two will do the trick.
>>1. in the dataset view click on the refresh fields button (it is to the
>>right of the ... and looks like the refresh button from IE
>>2. Make sure the command type is stored procedure and just put in the name
>>of the stored procedure like this: MyStoredProcName
>>Not like this: Exec MyStoredProcName
>>After doing this then try #1 again.
>> Hi All
>> I am an RS Newbie - Please be gentle :-))
>>[quoted text clipped - 23 lines]
>> Denzil|||Thanks Bruce
yes that was the answer
Many many thanks for your assistance
I really appreciate it
have agreat day
Darren
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200602/1|||No problem. Support is strong for stored procedures but some of what you
need to do is not intuitive.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Denzil via SQLMonster.com" <u18940@.uwe> wrote in message
news:5c4128a5414d2@.uwe...
> Thanks Bruce
> yes that was the answer
> Many many thanks for your assistance
> I really appreciate it
> have agreat day
> Darren
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200602/1sql

Binary-tree lookup.....

Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
index table ?
Thanks,
John
Can you be rephrase the question? SQL Server always uses b-trees for it's
indexes.
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>
|||SQL Server 2000 indexes are organized as B-trees. Details are available in
BOL.
joe.
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>
|||Is this way of indexing (B-trees) from the first release of SQL Server or is
got implemented in the subsequent releases of SQL Server?
Thanks for your feedback.
John
"Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
news:J2T6e.10242$Zn3.2388@.trnddc02...
> SQL Server 2000 indexes are organized as B-trees. Details are available in
> BOL.
>
> joe.
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
>
|||The current way of implementing B-trees has been used since at least 7.0.
Earlier versions used B-trees as well but the underlying implementation of
data pages and indexes was somewhat different.
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Is this way of indexing (B-trees) from the first release of SQL Server or
> is
> got implemented in the subsequent releases of SQL Server?
> Thanks for your feedback.
> John
>
> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
> news:J2T6e.10242$Zn3.2388@.trnddc02...
>
|||To expand a little bit. Earlier, the leaf level of a non-clustered index always had the physical
address of the row. As of 7.0, only non-clustered indexes over heap tables has the physical row
address. Non-clustered index on a table which has a clustered index has the clustered key in the
leaf level (the "row locator"). Apart from that, the implementation is the same (making both old and
new architecture be+ trees, methinks).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
> The current way of implementing B-trees has been used since at least 7.0. Earlier versions used
> B-trees as well but the underlying implementation of data pages and indexes was somewhat
> different.
> --
> Andrew J. Kelly SQL MVP
>
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
>
|||I think the term B-plus trees was used by Oracle. They are actually not
B-tree's because
they are not conform all requirements of B-tree's. A B-tree's node is
always filled for
at least (about) 50 percent (with exception of the root), where Oracle does
not reorganise during deletion and can get nodes filled for less than 50
percent.
For SQL-server I think they are not 'pure' B-tree's either, because in the
'original'
description (Knut) of B-tree's the nodes contain pointer or date information
as wel
and not only the leaves. I think in SQL-server that all information is
present in the leaves.
(In Knut's implementation the info which was in the nodes (or root) was not
repeated
in the leaves.).
One other 'enhancement' to the B-tree is that all leaves are single or
double linked, this
makes traversing the leaves (a bit) faster. But then again all data has to
be present within
the leaves. (This has also a disadvantage (for older databases), in B-tree's
a complete
subtree of a b-tree can be replaced with only one update, when the leaves
are linked this is not
possible anymore).
Knut describes the B-tree with only a few rules, one of the key rules is
that all
nodes and leaves (except the root) are filled for at least (about) 50
percent. The tree can
only gain or lose a level at the root, so all leaves have the same distance
from the
root. (I think that SQL-server conforms to these rules, but not to all
rules.).
ben brugman
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
> To expand a little bit. Earlier, the leaf level of a non-clustered index
always had the physical
> address of the row. As of 7.0, only non-clustered indexes over heap tables
has the physical row
> address. Non-clustered index on a table which has a clustered index has
the clustered key in the
> leaf level (the "row locator"). Apart from that, the implementation is the
same (making both old and[vbcol=seagreen]
> new architecture be+ trees, methinks).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
7.0. Earlier versions used[vbcol=seagreen]
indexes was somewhat[vbcol=seagreen]
or is[vbcol=seagreen]
available in[vbcol=seagreen]
the
>
|||Well all I know is that the SQL developers call it a B-Tree. How it is
implemented as compared to others I don't really know or care<g>.
Andrew J. Kelly SQL MVP
"Ben Brugman" <Ben@.niethier.nl> wrote in message
news:fsSdnenUYu-7usHfRVnyuw@.casema.nl...
>I think the term B-plus trees was used by Oracle. They are actually not
> B-tree's because
> they are not conform all requirements of B-tree's. A B-tree's node is
> always filled for
> at least (about) 50 percent (with exception of the root), where Oracle
> does
> not reorganise during deletion and can get nodes filled for less than 50
> percent.
> For SQL-server I think they are not 'pure' B-tree's either, because in the
> 'original'
> description (Knut) of B-tree's the nodes contain pointer or date
> information
> as wel
> and not only the leaves. I think in SQL-server that all information is
> present in the leaves.
> (In Knut's implementation the info which was in the nodes (or root) was
> not
> repeated
> in the leaves.).
> One other 'enhancement' to the B-tree is that all leaves are single or
> double linked, this
> makes traversing the leaves (a bit) faster. But then again all data has to
> be present within
> the leaves. (This has also a disadvantage (for older databases), in
> B-tree's
> a complete
> subtree of a b-tree can be replaced with only one update, when the leaves
> are linked this is not
> possible anymore).
> Knut describes the B-tree with only a few rules, one of the key rules is
> that all
> nodes and leaves (except the root) are filled for at least (about) 50
> percent. The tree can
> only gain or lose a level at the root, so all leaves have the same
> distance
> from the
> root. (I think that SQL-server conforms to these rules, but not to all
> rules.).
> ben brugman
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
> in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
> always had the physical
> has the physical row
> the clustered key in the
> same (making both old and
> 7.0. Earlier versions used
> indexes was somewhat
> or is
> available in
> the
>
sql

Binary-tree lookup.....

Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
index table ?
Thanks,
JohnCan you be rephrase the question? SQL Server always uses b-trees for it's
indexes.
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>|||SQL Server 2000 indexes are organized as B-trees. Details are available in
BOL.
joe.
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>|||Is this way of indexing (B-trees) from the first release of SQL Server or is
got implemented in the subsequent releases of SQL Server?
Thanks for your feedback.
John
"Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
news:J2T6e.10242$Zn3.2388@.trnddc02...
> SQL Server 2000 indexes are organized as B-trees. Details are available in
> BOL.
>
> joe.
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
>|||The current way of implementing B-trees has been used since at least 7.0.
Earlier versions used B-trees as well but the underlying implementation of
data pages and indexes was somewhat different.
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Is this way of indexing (B-trees) from the first release of SQL Server or
> is
> got implemented in the subsequent releases of SQL Server?
> Thanks for your feedback.
> John
>
> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
> news:J2T6e.10242$Zn3.2388@.trnddc02...
>|||To expand a little bit. Earlier, the leaf level of a non-clustered index alw
ays had the physical
address of the row. As of 7.0, only non-clustered indexes over heap tables h
as the physical row
address. Non-clustered index on a table which has a clustered index has the
clustered key in the
leaf level (the "row locator"). Apart from that, the implementation is the s
ame (making both old and
new architecture be+ trees, methinks).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
> The current way of implementing B-trees has been used since at least 7.0.
Earlier versions used
> B-trees as well but the underlying implementation of data pages and indexe
s was somewhat
> different.
> --
> Andrew J. Kelly SQL MVP
>
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
>|||I think the term B-plus trees was used by Oracle. They are actually not
B-tree's because
they are not conform all requirements of B-tree's. A B-tree's node is
always filled for
at least (about) 50 percent (with exception of the root), where Oracle does
not reorganise during deletion and can get nodes filled for less than 50
percent.
For SQL-server I think they are not 'pure' B-tree's either, because in the
'original'
description (Knut) of B-tree's the nodes contain pointer or date information
as wel
and not only the leaves. I think in SQL-server that all information is
present in the leaves.
(In Knut's implementation the info which was in the nodes (or root) was not
repeated
in the leaves.).
One other 'enhancement' to the B-tree is that all leaves are single or
double linked, this
makes traversing the leaves (a bit) faster. But then again all data has to
be present within
the leaves. (This has also a disadvantage (for older databases), in B-tree's
a complete
subtree of a b-tree can be replaced with only one update, when the leaves
are linked this is not
possible anymore).
Knut describes the B-tree with only a few rules, one of the key rules is
that all
nodes and leaves (except the root) are filled for at least (about) 50
percent. The tree can
only gain or lose a level at the root, so all leaves have the same distance
from the
root. (I think that SQL-server conforms to these rules, but not to all
rules.).
ben brugman
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
> To expand a little bit. Earlier, the leaf level of a non-clustered index
always had the physical
> address of the row. As of 7.0, only non-clustered indexes over heap tables
has the physical row
> address. Non-clustered index on a table which has a clustered index has
the clustered key in the
> leaf level (the "row locator"). Apart from that, the implementation is the
same (making both old and
> new architecture be+ trees, methinks).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
7.0. Earlier versions used[vbcol=seagreen]
indexes was somewhat[vbcol=seagreen]
or is[vbcol=seagreen]
available in[vbcol=seagreen]
the[vbcol=seagreen]
>|||Well all I know is that the SQL developers call it a B-Tree. How it is
implemented as compared to others I don't really know or care<g>.
Andrew J. Kelly SQL MVP
"Ben Brugman" <Ben@.niethier.nl> wrote in message
news:fsSdnenUYu-7usHfRVnyuw@.casema.nl...
>I think the term B-plus trees was used by Oracle. They are actually not
> B-tree's because
> they are not conform all requirements of B-tree's. A B-tree's node is
> always filled for
> at least (about) 50 percent (with exception of the root), where Oracle
> does
> not reorganise during deletion and can get nodes filled for less than 50
> percent.
> For SQL-server I think they are not 'pure' B-tree's either, because in the
> 'original'
> description (Knut) of B-tree's the nodes contain pointer or date
> information
> as wel
> and not only the leaves. I think in SQL-server that all information is
> present in the leaves.
> (In Knut's implementation the info which was in the nodes (or root) was
> not
> repeated
> in the leaves.).
> One other 'enhancement' to the B-tree is that all leaves are single or
> double linked, this
> makes traversing the leaves (a bit) faster. But then again all data has to
> be present within
> the leaves. (This has also a disadvantage (for older databases), in
> B-tree's
> a complete
> subtree of a b-tree can be replaced with only one update, when the leaves
> are linked this is not
> possible anymore).
> Knut describes the B-tree with only a few rules, one of the key rules is
> that all
> nodes and leaves (except the root) are filled for at least (about) 50
> percent. The tree can
> only gain or lose a level at the root, so all leaves have the same
> distance
> from the
> root. (I think that SQL-server conforms to these rules, but not to all
> rules.).
> ben brugman
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
> in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
> always had the physical
> has the physical row
> the clustered key in the
> same (making both old and
> 7.0. Earlier versions used
> indexes was somewhat
> or is
> available in
> the
>

Binary-tree lookup.....

Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
index table ?
Thanks,
JohnCan you be rephrase the question? SQL Server always uses b-trees for it's
indexes.
--
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>|||SQL Server 2000 indexes are organized as B-trees. Details are available in
BOL.
joe.
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> index table ?
> Thanks,
> John
>|||Is this way of indexing (B-trees) from the first release of SQL Server or is
got implemented in the subsequent releases of SQL Server?
Thanks for your feedback.
John
"Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
news:J2T6e.10242$Zn3.2388@.trnddc02...
> SQL Server 2000 indexes are organized as B-trees. Details are available in
> BOL.
>
> joe.
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> > Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
> > index table ?
> > Thanks,
> > John
> >
> >
>|||The current way of implementing B-trees has been used since at least 7.0.
Earlier versions used B-trees as well but the underlying implementation of
data pages and indexes was somewhat different.
--
Andrew J. Kelly SQL MVP
"John Smith" <JSmith_SJ@.hotmail.com> wrote in message
news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Is this way of indexing (B-trees) from the first release of SQL Server or
> is
> got implemented in the subsequent releases of SQL Server?
> Thanks for your feedback.
> John
>
> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
> news:J2T6e.10242$Zn3.2388@.trnddc02...
>> SQL Server 2000 indexes are organized as B-trees. Details are available
>> in
>> BOL.
>>
>> joe.
>> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
>> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
>> > Is SQL Server 2000 has been optimized to allow binary-tree lookup in
>> > the
>> > index table ?
>> > Thanks,
>> > John
>> >
>> >
>>
>|||To expand a little bit. Earlier, the leaf level of a non-clustered index always had the physical
address of the row. As of 7.0, only non-clustered indexes over heap tables has the physical row
address. Non-clustered index on a table which has a clustered index has the clustered key in the
leaf level (the "row locator"). Apart from that, the implementation is the same (making both old and
new architecture be+ trees, methinks).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
> The current way of implementing B-trees has been used since at least 7.0. Earlier versions used
> B-trees as well but the underlying implementation of data pages and indexes was somewhat
> different.
> --
> Andrew J. Kelly SQL MVP
>
> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
>> Is this way of indexing (B-trees) from the first release of SQL Server or is
>> got implemented in the subsequent releases of SQL Server?
>> Thanks for your feedback.
>> John
>>
>> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
>> news:J2T6e.10242$Zn3.2388@.trnddc02...
>> SQL Server 2000 indexes are organized as B-trees. Details are available in
>> BOL.
>>
>> joe.
>> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
>> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
>> > Is SQL Server 2000 has been optimized to allow binary-tree lookup in the
>> > index table ?
>> > Thanks,
>> > John
>> >
>> >
>>
>>
>|||I think the term B-plus trees was used by Oracle. They are actually not
B-tree's because
they are not conform all requirements of B-tree's. A B-tree's node is
always filled for
at least (about) 50 percent (with exception of the root), where Oracle does
not reorganise during deletion and can get nodes filled for less than 50
percent.
For SQL-server I think they are not 'pure' B-tree's either, because in the
'original'
description (Knut) of B-tree's the nodes contain pointer or date information
as wel
and not only the leaves. I think in SQL-server that all information is
present in the leaves.
(In Knut's implementation the info which was in the nodes (or root) was not
repeated
in the leaves.).
One other 'enhancement' to the B-tree is that all leaves are single or
double linked, this
makes traversing the leaves (a bit) faster. But then again all data has to
be present within
the leaves. (This has also a disadvantage (for older databases), in B-tree's
a complete
subtree of a b-tree can be replaced with only one update, when the leaves
are linked this is not
possible anymore).
Knut describes the B-tree with only a few rules, one of the key rules is
that all
nodes and leaves (except the root) are filled for at least (about) 50
percent. The tree can
only gain or lose a level at the root, so all leaves have the same distance
from the
root. (I think that SQL-server conforms to these rules, but not to all
rules.).
ben brugman
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
> To expand a little bit. Earlier, the leaf level of a non-clustered index
always had the physical
> address of the row. As of 7.0, only non-clustered indexes over heap tables
has the physical row
> address. Non-clustered index on a table which has a clustered index has
the clustered key in the
> leaf level (the "row locator"). Apart from that, the implementation is the
same (making both old and
> new architecture be+ trees, methinks).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
> > The current way of implementing B-trees has been used since at least
7.0. Earlier versions used
> > B-trees as well but the underlying implementation of data pages and
indexes was somewhat
> > different.
> >
> > --
> > Andrew J. Kelly SQL MVP
> >
> >
> > "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> > news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
> >> Is this way of indexing (B-trees) from the first release of SQL Server
or is
> >> got implemented in the subsequent releases of SQL Server?
> >> Thanks for your feedback.
> >> John
> >>
> >>
> >> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
> >> news:J2T6e.10242$Zn3.2388@.trnddc02...
> >> SQL Server 2000 indexes are organized as B-trees. Details are
available in
> >> BOL.
> >>
> >>
> >> joe.
> >>
> >> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
> >> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
> >> > Is SQL Server 2000 has been optimized to allow binary-tree lookup in
the
> >> > index table ?
> >> > Thanks,
> >> > John
> >> >
> >> >
> >>
> >>
> >>
> >>
> >
> >
>|||Well all I know is that the SQL developers call it a B-Tree. How it is
implemented as compared to others I don't really know or care<g>.
--
Andrew J. Kelly SQL MVP
"Ben Brugman" <Ben@.niethier.nl> wrote in message
news:fsSdnenUYu-7usHfRVnyuw@.casema.nl...
>I think the term B-plus trees was used by Oracle. They are actually not
> B-tree's because
> they are not conform all requirements of B-tree's. A B-tree's node is
> always filled for
> at least (about) 50 percent (with exception of the root), where Oracle
> does
> not reorganise during deletion and can get nodes filled for less than 50
> percent.
> For SQL-server I think they are not 'pure' B-tree's either, because in the
> 'original'
> description (Knut) of B-tree's the nodes contain pointer or date
> information
> as wel
> and not only the leaves. I think in SQL-server that all information is
> present in the leaves.
> (In Knut's implementation the info which was in the nodes (or root) was
> not
> repeated
> in the leaves.).
> One other 'enhancement' to the B-tree is that all leaves are single or
> double linked, this
> makes traversing the leaves (a bit) faster. But then again all data has to
> be present within
> the leaves. (This has also a disadvantage (for older databases), in
> B-tree's
> a complete
> subtree of a b-tree can be replaced with only one update, when the leaves
> are linked this is not
> possible anymore).
> Knut describes the B-tree with only a few rules, one of the key rules is
> that all
> nodes and leaves (except the root) are filled for at least (about) 50
> percent. The tree can
> only gain or lose a level at the root, so all leaves have the same
> distance
> from the
> root. (I think that SQL-server conforms to these rules, but not to all
> rules.).
> ben brugman
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
> in bericht news:eBkiCT5PFHA.2604@.TK2MSFTNGP10.phx.gbl...
>> To expand a little bit. Earlier, the leaf level of a non-clustered index
> always had the physical
>> address of the row. As of 7.0, only non-clustered indexes over heap
>> tables
> has the physical row
>> address. Non-clustered index on a table which has a clustered index has
> the clustered key in the
>> leaf level (the "row locator"). Apart from that, the implementation is
>> the
> same (making both old and
>> new architecture be+ trees, methinks).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
>> news:%23C%23Cc64PFHA.3668@.TK2MSFTNGP14.phx.gbl...
>> > The current way of implementing B-trees has been used since at least
> 7.0. Earlier versions used
>> > B-trees as well but the underlying implementation of data pages and
> indexes was somewhat
>> > different.
>> >
>> > --
>> > Andrew J. Kelly SQL MVP
>> >
>> >
>> > "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
>> > news:%23jwyRl4PFHA.1500@.TK2MSFTNGP09.phx.gbl...
>> >> Is this way of indexing (B-trees) from the first release of SQL Server
> or is
>> >> got implemented in the subsequent releases of SQL Server?
>> >> Thanks for your feedback.
>> >> John
>> >>
>> >>
>> >> "Joe Yong" <NO_jyong_SPAM@.scalabilityexperts.com> wrote in message
>> >> news:J2T6e.10242$Zn3.2388@.trnddc02...
>> >> SQL Server 2000 indexes are organized as B-trees. Details are
> available in
>> >> BOL.
>> >>
>> >>
>> >> joe.
>> >>
>> >> "John Smith" <JSmith_SJ@.hotmail.com> wrote in message
>> >> news:eAEQdz3PFHA.3596@.TK2MSFTNGP15.phx.gbl...
>> >> > Is SQL Server 2000 has been optimized to allow binary-tree lookup
>> >> > in
> the
>> >> > index table ?
>> >> > Thanks,
>> >> > John
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>

BINARY_CHECKSUM

Hi All,
I am using BINARY_CHECKSUM value to detect the changes i.e. while
comparing two table's data. I have tested with few data. Seems it is
working fine. Are there any limitations to use BINARY_CHECKSUM
function? I know it will not with few data types. Luckily I don't
have those data types n both the tables.
So Pls inform me the Limitation and the steps i need to consider while
using BINARY_CHECKSUM function?
Or pls suggest me some other easiest method.
Thanks and regards
PraveenPraveen
Yes , there is a chance that you will get the same values for different
data
Please search on internet , I think it was a discussion about that some
times ago at this forum
"Praveen" <apveen@.gmail.com> wrote in message
news:1147676068.594978.14940@.u72g2000cwu.googlegroups.com...
> Hi All,
> I am using BINARY_CHECKSUM value to detect the changes i.e. while
> comparing two table's data. I have tested with few data. Seems it is
> working fine. Are there any limitations to use BINARY_CHECKSUM
> function? I know it will not with few data types. Luckily I don't
> have those data types n both the tables.
> So Pls inform me the Limitation and the steps i need to consider while
> using BINARY_CHECKSUM function?
> Or pls suggest me some other easiest method.
>
> Thanks and regards
> Praveen
>|||Any type of checksum or hash may not properly detect changes in a huge
number of cases -- BINARY_CHECKSUM's output is only 4 bytes, whereas if you
have many columns there could be hundreds or thousands of bytes of input
data. I do not recommend relying on checksums for this purpose. Instead,
compare either column by column, or maintain either a ROWVERSION or a date
last updated column.
For more information on why checksums are a poor choice, see:
http://en.wikipedia.org/wiki/Pigeonhole_principle
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Praveen" <apveen@.gmail.com> wrote in message
news:1147676068.594978.14940@.u72g2000cwu.googlegroups.com...
> Hi All,
> I am using BINARY_CHECKSUM value to detect the changes i.e. while
> comparing two table's data. I have tested with few data. Seems it is
> working fine. Are there any limitations to use BINARY_CHECKSUM
> function? I know it will not with few data types. Luckily I don't
> have those data types n both the tables.
> So Pls inform me the Limitation and the steps i need to consider while
> using BINARY_CHECKSUM function?
> Or pls suggest me some other easiest method.
>
> Thanks and regards
> Praveen
>sql

BINARY_CHECKSUM

Hi All,
I am using BINARY_CHECKSUM value to detect the changes i.e. while
comparing two table's data. I have tested with few data. Seems it is
working fine. Are there any limitations to use BINARY_CHECKSUM
function? I know it will not with few data types. Luckily I don't
have those data types n both the tables.
So Pls inform me the Limitation and the steps i need to consider while
using BINARY_CHECKSUM function?
Or pls suggest me some other easiest method.
Thanks and regards
PraveenPraveen
Yes , there is a chance that you will get the same values for different
data
Please search on internet , I think it was a discussion about that some
times ago at this forum
"Praveen" <apveen@.gmail.com> wrote in message
news:1147676068.594978.14940@.u72g2000cwu.googlegroups.com...
> Hi All,
> I am using BINARY_CHECKSUM value to detect the changes i.e. while
> comparing two table's data. I have tested with few data. Seems it is
> working fine. Are there any limitations to use BINARY_CHECKSUM
> function? I know it will not with few data types. Luckily I don't
> have those data types n both the tables.
> So Pls inform me the Limitation and the steps i need to consider while
> using BINARY_CHECKSUM function?
> Or pls suggest me some other easiest method.
>
> Thanks and regards
> Praveen
>|||Any type of checksum or hash may not properly detect changes in a huge
number of cases -- BINARY_CHECKSUM's output is only 4 bytes, whereas if you
have many columns there could be hundreds or thousands of bytes of input
data. I do not recommend relying on checksums for this purpose. Instead,
compare either column by column, or maintain either a ROWVERSION or a date
last updated column.
For more information on why checksums are a poor choice, see:
http://en.wikipedia.org/wiki/Pigeonhole_principle
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Praveen" <apveen@.gmail.com> wrote in message
news:1147676068.594978.14940@.u72g2000cwu.googlegroups.com...
> Hi All,
> I am using BINARY_CHECKSUM value to detect the changes i.e. while
> comparing two table's data. I have tested with few data. Seems it is
> working fine. Are there any limitations to use BINARY_CHECKSUM
> function? I know it will not with few data types. Luckily I don't
> have those data types n both the tables.
> So Pls inform me the Limitation and the steps i need to consider while
> using BINARY_CHECKSUM function?
> Or pls suggest me some other easiest method.
>
> Thanks and regards
> Praveen
>

Binary Tree Problem in SQLServer

Hi Members
I m new in this forum, I have have Binary Tree database in SQL Server with
table fields(Mcode,Mname,LeftMCode,RightMCode). i want to display downline and pairs of each member.
can any one help me out?
Regards
Amirbkkread this.
is for OLAP, but, maybe help you.

http://www.codeproject.com/cs/database/tree_olap.asp|||From your column names, I'm guessing your are dealing with a Nested Set model ala' Joe Celko, rather than the more common Adjencency Model.
You should be able to find some code samples here:
http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=1266295
...or by googling "Celko Nested Sets".|||Thanx for reply

But i have little prob that all nodes will be freely put on any side means any member can be put on left or right side and my db will grow very fast and estimated records will be more than 100000 with in few months

so if i use lineage and depth methods can i store path in one fields
and if use set model than i think , left node must be fill first and right node must be +1 than its left node.
and in my db any node(member) should be put on any side

so guys and suggestion will be higly appreciated.
i m going to build db with in few days , plz help me out.

Regards,

Amir|||Thanx for reply

But i have little prob that all nodes will be freely put on any side means any member can be put on left or right side and my db will grow very fast and estimated records will be more than 100000 with in few months

so if i use lineage and depth methods can i store path in one fields
and if use set model than i think , left node must be fill first and right node must be +1 than its left node.
and in my db any node(member) should be put on any side

so guys and suggestion will be higly appreciated.
i m going to build db with in few days , plz help me out.

Regards,

Amir

Binary to Varchar

I am trying to conver a binary column in the source table to a varchar as sh
own
select convert(varchar(32),0x00000000000003F3) it retunrns a null
hoe do i go about doing it?
Thankssatya wrote:
> I am trying to conver a binary column in the source table to a varchar as
shown
> select convert(varchar(32),0x00000000000003F3) it retunrns a null
> hoe do i go about doing it?
The following works for me:
select convert(varchar(32), convert(int, 0x00000000000003F3))

Binary Problem

Hy friends!

I'm new in WebApplications that have SQL SERVER DB.

My problem is that...

In the DataBase I have a table with varbinary column and in the program I want save in this column a value of binary[] variable! How I can make it?

Another question... If I want select (by a query in the application) the value of the binary column, where I store it? because if I want select an integer value I take this in a int variable, and if I want select an string value from a DataBase I take this in a string variable..but How I can make it with binary column?

Thanks in advance!!

The following Scott Mitchell tutorial should help you

http://aspnet.4guysfromrolla.com/articles/081705-1.2.aspx

sql

Thursday, March 22, 2012

Binary or Byte data linked to Checkbox

Dear Group,
I'm using Access 2003 linked to an SQL Server data table via an ODBC
connection.
On one form I have several check boxes which want data mapped to a
TRUE/FALSE datatype. Is there a direct way to bind a checkbox to a
bit, a binary, or a tinyint? I've only been able to get it to work
with a smallint which is 2 bytes long.
Thanks,
Max
Arg. Access wants to insert -1 for true and 0 for false.
So sorry the type will need to support negative numbers.
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Max Yaffe" <myaffe@.not.gamry.com> wrote in message
news:0f1ji1p22uleclnn5t4lka3vnta48bda3k@.4ax.com...
> Dear Group,
> I'm using Access 2003 linked to an SQL Server data table via an ODBC
> connection.
> On one form I have several check boxes which want data mapped to a
> TRUE/FALSE datatype. Is there a direct way to bind a checkbox to a
> bit, a binary, or a tinyint? I've only been able to get it to work
> with a smallint which is 2 bytes long.
> Thanks,
> Max

Binary or Byte data linked to Checkbox

Dear Group,
I'm using Access 2003 linked to an SQL Server data table via an ODBC
connection.
On one form I have several check boxes which want data mapped to a
TRUE/FALSE datatype. Is there a direct way to bind a checkbox to a
bit, a binary, or a tinyint? I've only been able to get it to work
with a smallint which is 2 bytes long.
Thanks,
MaxArg. Access wants to insert -1 for true and 0 for false.
So sorry the type will need to support negative numbers.
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Max Yaffe" <myaffe@.not.gamry.com> wrote in message
news:0f1ji1p22uleclnn5t4lka3vnta48bda3k@.
4ax.com...
> Dear Group,
> I'm using Access 2003 linked to an SQL Server data table via an ODBC
> connection.
> On one form I have several check boxes which want data mapped to a
> TRUE/FALSE datatype. Is there a direct way to bind a checkbox to a
> bit, a binary, or a tinyint? I've only been able to get it to work
> with a smallint which is 2 bytes long.
> Thanks,
> Max

Binary files in DB : set name on retrieve

Hello,

I have a table that stores binary files. When I serve them up to the user, I call the following page (serveDocument.aspx?DocumentID=xxx) which holds only the following code and pass the document ID:

Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load
Dim DocumentIDAs Integer = Convert.ToInt32(Request.QueryString("DocumentID"))

'Connect to the database and bring back the image contents & MIME type for the specified picture Using myConnectionAs New SqlConnection(ConfigurationManager.ConnectionStrings("kelly_lmConnectionString1").ConnectionString)

Const SQLAs String ="SELECT [Content_Type], [Document_Data] FROM [lm_Service_Detail_Documents] WHERE [Document_id] = @.Document_id"Dim myCommandAs New SqlCommand(SQL, myConnection)
myCommand.Parameters.AddWithValue("@.Document_id", DocumentID)

myConnection.Open()
Dim myReaderAs SqlDataReader = myCommand.ExecuteReader

If myReader.ReadThen Response.ContentType = myReader("Content_Type").ToString()
Response.BinaryWrite(myReader("Document_Data"))
End If myReader.Close() myConnection.Close()End Using
End Sub

It works perfectly. But heres the thing: I want users to be able to right click on the link and chose 'Save Target As'. In IE 7, this works fine. In FireFox it saves the document as 'serveDocument.aspx'. Is there any way toinjectthe filename that I want to save the document as?

Thank you.

Add this Header also

context.Response.ContentType = "application/octet-stream";
context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename+".txt" + "\"");

------------------

Mark as Answer if you feel

|||

What does 'context' refer to?

And, are you saying I shouldn't set the ContentType to the actual type of file?


|||

REmove the context

it uses to html encode when you are using http handler

|||

Well, that partially works. When a user clicks the linkthen saves the file, the correct name is present. But, my issue isn't that... I want the user to be able to right click the link and 'Save Link As...' with the correct filename. When I do that, it still says 'documentServe.aspx'.

|||

Hi,

But heres the thing: I want users to be able to right click on the link and chose 'Save Target As'. In IE 7, this works fine. In FireFox it saves the document as 'serveDocument.aspx'.

From your description, it seems that when you right click on the link and choose the 'save target as' in IE7, you can got the whole url with parameters, but not in FireFox, right?

If so, I'm afraid that the behavior is related to the Explorer, and based on my knowledge, there's not any workaround to fix the problem, since working mechanism for IE and FireFox is just not the same.

Thanks.

sql

Binary Data Type

Hello Dears,

I was Maked Pictures table in sql server 2005 with Two Col pic_Id (int) and picture(binary)

i need now ro insert image into this table by Asp.net under VB.net Code i have in my form FileUpload and button control

and this is my Code

ProtectedSub btnLoad_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnLoad.Click

Dim content()AsByte = ReadBitmap2ByteArray(FileUpload1.PostedFile.ContentType)

StoreBlob2DataBase(content)

EndSub

Function ReadBitmap2ByteArray(ByVal FileNameAsString)AsByte()

Dim imageAs Drawing.Bitmap =New Drawing.Bitmap(FileName)

Dim streamAs IO.MemoryStream =New IO.MemoryStream()

image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)

Return stream.ToArray

EndFunction

Sub StoreBlob2DataBase(ByVal contentAsByte())

con.Open()

Dim cmAsNew SqlCommand("Insert into Pictures(Pic_Id,picture) values(@.id,@.pic)", con)

cm.Parameters.AddWithValue("@.ID", 1)

Dim p1AsNew SqlParameter

p1.ParameterName ="@.pic"

p1.SqlDbType = Data.SqlDbType.Binary

p1.Value = content

p1.Size = content.Length

cm.Parameters.Add(p1)

cm.ExecuteNonQuery()

EndSub

when i make run to my website it give me an Exeption in this statement

Dim imageAs Drawing.Bitmap =New Drawing.Bitmap(FileName)

it tell me that Parameter is not valid

i need help about this please

with my Best regard

khalil

In this line:

Dim content()AsByte = ReadBitmap2ByteArray(FileUpload1.PostedFile.ContentType)

You are passing in the contentType rather than a filename.

|||

HI

its does not work also its give me the same error what can i do

|||

Of course it gives you the same error, I didn't fix it, I just pointed out what was wrong. Pass in the filename of the file, not the contenttype.