|
Hi guys
I've have set up a data-table in MS Access.
I have a colomn with the names of my data and a column with numbering of the data (One number for each name). I then have a new entry of data, which I want to compare to the data in my table. I want to do this by calculating the distances between the new data and all of the data (numberings) in the data-table. Finally I want to choose the ten data-items from the tables, which have the shortest distance to the new data-entry.
My problem is... How can I in sql-code calculate the distances, one row at a time - save them and later compare all the distances and choosing the ten shortest ones.
I haven't done much sql-code before - so i would really apreciate any suggestions or maybe some good links
Thanks in advance
AL
|
|
|
|
|
Hi every buddy,
I have setup data replication in Sql server 2000. There are two servers over the LAN named ATech and AJK. RIght nowI've setup transactional replication such that Atech is the publisher and AJK the subscriber but I also want AJK to publish some of its tables to ATech as well. When I tery to do that and make a push subscription to Atech it gives an error and says that SQLAgent$AJK doesnt exist on LEOPARD\ATECH as an installed object. So instead of making a push subscription I made a pull subscription as well but that also doesnt seem to be working coz the moment I inserted a new record at AJK it gave out an error saying that a particular stored prcedure named something liek sp_MSins_Bill doesnt exist. I made a copy of it from AJK to ATech buut its still not working v well.
So Can u plz tell me how to establish this kind of topology when both of the servers are Publisher as well as subscriber?
Does it have something to do with the configuring of Publisher/subscriber and distributor. In my case the ATech Server is the publsher and distributor while AJK is the subscriber.
Any help would be highly appreciated
Thanks in advance,
Rocky
|
|
|
|
|
hi everyone,
i am using SQL SERVER 2005 Database
and i want to build Stored Procedure in a database (DB_1)
and i want the stored Procedure to query data from another Database (DB_2)
Note: this stored Procedure is exist in the first Database (DB_1)
Can any one help
i need it so much.
best wishes,karim
|
|
|
|
|
If DB_2 is in the same SQL Server instance, you only need to prefix the schema name with DB_2. For instance:
SELECT a.Id, b.OtherItem FROM MyTable a INNER JOIN DB_2.dbo.MyTable2 b ON a.Id = b.FK_Id
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
select * from property
where
substring(func_key,1,5) = 'GEOSS'
And substring(func_key,6,8)>= 3 and
where substring(func_key,9,16)='PV000000'
And Attrib_code = substring(Attrib_code,5,2)=16
i do i Executre this in One
Vuyiswa
|
|
|
|
|
Why didn't you use the "Modify" button rather than create a new post?
|
|
|
|
|
Try this.
select * from property
where
substring(func_key,1,5) = 'GEOSS'
And substring(func_key,6,8)>= 3 and
substring(func_key,9,16)='PV000000'
And substring(Attrib_code,5,2)=16
Regards,
Arun Kumar.A
|
|
|
|
|
I need to Find All the Records that Are GEOSS and that are not DUETt.The Following statement made that Possible.
select * from property
where substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3
*There is a Column that is named lis_key in the above results i need to select it from the results above results distictively and search based on that Distict lis_key to Find al records that have
Func_key column ='PV000000' and substring(Attrib_code,5,2)!=16
Please Help ,i hope i explained it clear today
Vuyiswa
|
|
|
|
|
Try this.
select * from property where lis_key in
(select lis_key from property
where substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3)
and Func_key column ='PV000000' and substring(Attrib_code,5,2)!=16
If U want something other than this, provide sample data of around 5
rows (for the required columns alone), and the output result U want.
Regards,
Arun Kumar.A
|
|
|
|
|
OOH GOd you are Good, but i need you to make th results to be Distinct based on Lis_key,If you could just add distinct in that Query.
Thanks a lot again.
You are Good
Vuyiswa
|
|
|
|
|
hi thank you a lot , am noting you Sir, please attend to next Problem.
I NEED TO UPDATE THESES RECORDS BASED ON THIS QUERY
select * from property where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
order by Lis_key
HELP ME
Vuyiswa
|
|
|
|
|
Do U want to update a column which satisfy these conditions?
If so,
We can do that by using a simple update statement:
update property set columnName=value where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
order by Lis_key
Regards,
Arun Kumar.A
|
|
|
|
|
The Following is the update i want to do, con you combine these from what you gave me previously.
but it gives me an Error
"Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '('.
"
update property
set substring(Attrib_code,5,2)=16
where Exists (select * from property where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
)
Vuyiswa
|
|
|
|
|
Haw can U assign to the value returned by the substring function?
Try this:
update property
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
where Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
)
"n" must be the lenght of characters after 16.
Note:Before testing, make sure U have backup of the table.
Regards,
Arun Kumar.A
|
|
|
|
|
hi Arun thakns again Can yo Please explain these line of code to me, why this Positions in substring
update property
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
Vuyiswa
|
|
|
|
|
Hi,
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
Let Attrib_code ='abcde10xyz'
U R trying to change the numbet 10 to 16.
substring(Attrib_code,0,5) will return 'abcde'
substring(Attrib_code,7,3) will return 'xyz'
so 'abcde'+'16'+'xyz' will evaluate to 'abcde16xyz'.
Have I given the right update command?
Regards,
Arun Kumar.A
|
|
|
|
|
Thank you Sir Arun.Immanuel you have given me the right update command, my table is looking good.AM taking note of you.
Kind regards
Vuyiswa Maseko
vuyiswam@Tshwane.gov.za
South Africa
Vuyiswa
|
|
|
|
|
Welcome.
Regards,
Arun Kumar.A
|
|
|
|
|
i have a Query that is workng well
select * from property
where
substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3
it Display all the records that has 'GEOSS' and has a functional key that is equal to 3 and greater than 3. the Query is working.
NB:* The 'GEOSS' Records are Subtyptes of PVOOOOOO Records. It means that the main Key will be like '022100550.PV000000' and the Subtypes will be
'022100550.GEOSS001
'022100550.GEOSS002
'022100550.GEOSS003
Those are subtypes of 022100550.PV000000. above SQL statement searches them and Exclude the main key, i need a separate key that will show all main keys of the subkeys. that means all the PV000000 that has Sub keys GEOSS.
Please Help
where the
Vuyiswa Maseko Junior Programmer that will never stop learning form Code Project
|
|
|
|
|
Why don't you break all this information in to separate columns? At the moment it looks like it is breaking the first normal form (Keep separate data in separate columns). Wouldn't it make it much easier and more efficient to query?
|
|
|
|
|
This is a large Database that holds the propery of whole Province, i was built i can create my own fields i have to search for what they want and Fix what they want.
Vuyiswa
|
|
|
|
|
Can you rephrase that. I didn't understand it.
|
|
|
|
|
I have created the login page of my project,I want create a stored procedure in SQL 2005for the user login page how to compare the two text boxes, please any body help me with the stored procedure and how to call the that stored procedure from server page in c#.
Thank you
Bilal Ahmed Wani.
Software Traniee.
|
|
|
|
|
Bilal wani wrote: how to compare the two text boxes
That is not a function of SQL Server. That is a function of your application.
Bilal wani wrote: please any body help me with the stored procedure and how to call the that stored procedure from server page in c
If you are asking that level of question then perhaps a tutorial on accessing SQL Server from a .NET application would be more useful to you. Search results[^]
|
|
|
|
|
Dear Friend ,
I have created the login page, you just go through the code of that page below:
Client End:(ASP.NET 2005)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<title>Metalearn Login Page
// <!CDATA[
// ]]>
<asp:panel id="Panel1" runat="server" backcolor="MidnightBlue" height="236px" style="z-index: 100;
left: 429px; position: absolute; top: 176px; border-left-style:inset; border-bottom-color:Aqua; border-right-color:Aqua" width="425px" forecolor="Aqua">
<asp:label id="Label2" runat="server" height="23px" style="z-index: 100; left: 36px;
position: absolute; top: 53px" text="User Name" width="129px">
<asp:button id="Button2" runat="server" style="z-index: 101; left: 183px; position: absolute;
top: 160px" text="Sign In" validationgroup="SignIn" onclick="Button2_Click" backcolor="CornflowerBlue" bordercolor="CornflowerBlue" width="77px">
<asp:label id="Label3" runat="server" height="25px" style="z-index: 102; left: 35px;
position: absolute; top: 111px" text="Password" width="96px">
<asp:textbox id="txtuname" runat="server" style="z-index: 103; left: 210px; position: absolute;
top: 55px" backcolor="Beige" validationgroup="SignIn">
<asp:textbox id="passwrd" runat="server" style="z-index: 104; left: 211px; position: absolute;
top: 108px" textmode="Password" width="149px" backcolor="LightGoldenrodYellow" validationgroup="SignIn">
<asp:requiredfieldvalidator id="RequiredFieldValidator2" errormessage="* Please enter your Password" controltovalidate="TextBox1" validationgroup="SignIn" runat="server" style="z-index: 105; left: 209px; position: absolute; top: 137px" font-size="XX-Small" width="187px">
<asp:button id="Button1" runat="server" validationgroup="SignIn" style="z-index: 106; left: 270px; position: absolute;
top: 159px" text="Reset" onclick="Button1_Click" backcolor="CornflowerBlue" bordercolor="CornflowerBlue" width="104px">
<asp:requiredfieldvalidator id="RequiredFieldValidator1" errormessage="* Please enter your User Name" controltovalidate="TextBox1" validationgroup="SignIn" runat="server" style="z-index: 107; left: 208px; position: absolute; top: 84px" font-size="XX-Small" width="201px">
<asp:label id="Label1" runat="server" height="19px" style="z-index: 101; left: 460px;
position: absolute; top: 194px" text=" Login In Here" width="247px" forecolor="Cyan">
<asp:panel id="Panel2" runat="server" backcolor="White" forecolor="MintCream"
="" height="428px" style="z-index: 99; left: 146px; position: absolute; top: 81px; border-style:outset;
border-bottom-color:Lime; border-left-color:Lime; border-right-color:Lime; border-top-color:Lime" width="742px">
<asp:label id="lblerrormsg" runat="server" forecolor="Red" style="z-index: 101; left: 310px;
position: absolute; top: 346px" width="282px">
Server end:(C#)
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Banking.Encryption;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Put user code to initialize the page here //info.dll DATA =G5HQ4RcM3shUNn5uaYHTztba/UuiBuDG
}
protected void Button2_Click(object sender, EventArgs e)
{
EncryptDecrypt objEncrypt = new EncryptDecrypt();
if (txtuname.Text = "bank" & passwrd.Text = "bn")
{
Response.Redirect("Mainmenu.aspx", false);
}
else
{
lblerrormsg.Text = "Invalid Login";
//Button2.Attributes.Add("onclick", "return validations();");
txtuname.Text = "";
passwrd.Text = "";
txtuname.Focus();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
lblerrormsg.Text = "";
txtuname.Text = "";
passwrd.Text = "";
txtuname.Focus();
}
}
Now the thing I have created a database table in SQL which can store userlogins now I want to know how to write the code in c# which can verify userlogins how to pass the parameters to compare user logins.
Thanks
Bilal
|
|
|
|
|