Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Friday, March 30, 2012

How to insert record to SQL server which is on the other machine from client computer?

I want to write simple sql database project that that works in the network. and i need to insert record from a client to a server that is on the other machine.

This is a pretty broad question. I suggest you do some additional research online or via any one of a number of excellent books, articles or whitepapers.

This will require that you (at least)

Install and configure the SQL Server on the remote system.

Friday, February 24, 2012

how to implement a recursive algorithm as iterative?

Hi,
I have to go through some tables, like a network. I have a recursive
algorithm, but I need to do it iteratively.
Basically, there are 2 tables through which I have to go: Items table and
Relationship table.
The tables I have defined are like this:
- Item table, 2 fields: ItemID, ItemWeight
- Relationships table, 3 fields: Item1, Item2, LinkWeight.
Given Item x, I need to get all of the items related to it. It has to go
down through that item's related items if relationship weight is greater tha
n
item weight.
It stops
- when relationship weight is lower than item weight,
- it has already propagated all of the items
I have this algorithm:
I defined 2 global variables:
- PropagatedItems - contains all of the items that have been "visited" and
their related items
- FoundItems: contains the items that were visited but not its related items
Sub GetRelatedItems(ByVal idItem As Integer)
Dim idit As Integer
If ItemIsIncluded(idItem) Then
Set rlinks = CurrentDb().OpenRecordset("Select iditem1, iditem2,
linkweight from linkweight where item1 = " & idItem & " or item2 = " & idIte
m)
While Not rlinks.EOF
If rlinks.iditem1 = idItem Then
idit = rlinks.iditem2
Else
idit = rlinks.iditem1
End If
If rlinks.linkweight < GetItemWeight(idit) Then
IncludeItem (idit)
Else
GetRelatedItems(idit)
End If
rlinks.MoveNext
Wend
End If
End Sub
Sub Main()
GetRelatedItems(ItemID)
End sub
The problem I have is volume: this database could have a million or more
items.
That's why I can't go through this tables with a recursive algorithm.
Can you help me? How could this be done in a better way?See responses inline:
amota wrote:
> Hi,
> I have to go through some tables, like a network. I have a recursive
> algorithm, but I need to do it iteratively.
> Basically, there are 2 tables through which I have to go: Items table
> and Relationship table.
> The tables I have defined are like this:
> - Item table, 2 fields: ItemID, ItemWeight
> - Relationships table, 3 fields: Item1, Item2, LinkWeight.
> Given Item x, I need to get all of the items related to it. It has to
> go
> down through that item's related items if relationship weight is
> greater than item weight.
> It stops
> - when relationship weight is lower than item weight,
> - it has already propagated all of the items
> I have this algorithm:
> I defined 2 global variables:
> - PropagatedItems - contains all of the items that have been
> "visited" and their related items
> - FoundItems: contains the items that were visited but not its
> related items
> Sub GetRelatedItems(ByVal idItem As Integer)
> Dim idit As Integer
> If ItemIsIncluded(idItem) Then
> Set rlinks = CurrentDb().OpenRecordset("Select iditem1, iditem2,
> linkweight from linkweight where item1 = " & idItem & " or item2 = "
> & idItem)
I'm not clear why you are asking an Access question (this is DAO code) in a
SQL Server newsgroup. You run the risk of getting responses that will work
in SQL Server but not in Access. Your better plan would have been to ask in
an Access newsgroup such as microsoft.public.access.queries.

> While Not rlinks.EOF
> If rlinks.iditem1 = idItem Then
> idit = rlinks.iditem2
> Else
> idit = rlinks.iditem1
> End If
> If rlinks.linkweight < GetItemWeight(idit) Then
> IncludeItem (idit)
> Else
> GetRelatedItems(idit)
> End If
> rlinks.MoveNext
> Wend
> End If
> End Sub
> Sub Main()
> GetRelatedItems(ItemID)
> End sub
> The problem I have is volume: this database could have a million or
> more items.
> That's why I can't go through this tables with a recursive algorithm.
> Can you help me? How could this be done in a better way?
How about this:
Select i.ItemID,r1.Item2, r2.Item1
from (Items i inner join linkweight r1 on i.ItemID = r1.Item1)
inner join linkweight r2 on i.ItemId = r2.Item2
Where r1.linkweight > ItemWeight and
r2.linkweight > ItemWeight
order by ItemID
If that does not give you what you want, perhaps you need a union query:
Select i.ItemID,r1.Item2 RelatedItem
from Items i inner join linkweight r1 on i.ItemID = r1.Item1
Where r1.linkweight > ItemWeight
Union
Select i.ItemID,r1.Item1
from Items i inner join linkweight r2 on i.ItemID = r2.Item1
Where r2.linkweight > ItemWeight
order by ItemID
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"|||"amota" <amota@.discussions.microsoft.com> wrote in message
news:25EB9702-0A72-4961-B115-856788E503D1@.microsoft.com...
> Hi,
> I have to go through some tables, like a network. I have a recursive
> algorithm, but I need to do it iteratively.
>
<snip>
amota,
Please repost your message to the following newsgroup:
microsoft.pulic.access.modulesdaovba
Sincerely,
Chris O.|||I'm just using access as a demo, but I plan to do it with SQL Server.
That's why I posted here in this group.
--
amota
"Chris2" escribió:

> "amota" <amota@.discussions.microsoft.com> wrote in message
> news:25EB9702-0A72-4961-B115-856788E503D1@.microsoft.com...
> <snip>
> amota,
> Please repost your message to the following newsgroup:
> microsoft.pulic.access.modulesdaovba
>
> Sincerely,
> Chris O.
>
>|||So did you try my suggestions ... ?
amota wrote:
> I'm just using access as a demo, but I plan to do it with SQL Server.
> That's why I posted here in this group.
>
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"|||hmm, no, didnt work.
First one, gives me an empty record set
Second one, doesn't give a complete set.
Also, I asked here because I think it's better to do it as a stored procedur
e.
amota
"Bob Barrows [MVP]" escribió:

> So did you try my suggestions ... ?
> amota wrote:
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>|||example:
ITEMS TABLE:
ItemID ItemWeight
10 -1
11 0.3
12 1
13 -0.2
Relationships TABLE:
Item1 Item2 linkweight
11 10 0.1
12 10 0.42
12 11 0.5
13 10 0.33
13 12 -0.33
For Item 13:
Correct set: 13, 10, 11, 12
Notice that direct related are 13 and 10
Items related to 10 are 11 and 12
Your first suggestion, gives empty,
the second one, gives 2 records: 13,10 and 13,13
--
amota
"Bob Barrows [MVP]" escribió:

> So did you try my suggestions ... ?
> amota wrote:
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>|||Look at this example (in T-SQL):
http://milambda.blogspot.com/2005/0...or-monkeys.html
A good hyerarchy begins with a model that prevents circular referencing.
ML|||Again, the syntactical differences between JetSQL and Transact-SQL (SQL
Server's variant of SQL) may prevent suggestions made here from being usable
in your Access prototype. You should consider prototyping with MSDE.
Whether or not a stored procedure is used is somewhat irrelevant to the
question about what is the best sql to use for your task.
Your followup message provides some sample data so i will reply to that one.
amota wrote:
> hmm, no, didnt work.
> First one, gives me an empty record set
> Second one, doesn't give a complete set.
> Also, I asked here because I think it's better to do it as a stored
> procedure.
> --
> amota
>
> "Bob Barrows [MVP]" escribi:
>
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.|||amota wrote:
> example:
> ITEMS TABLE:
> ItemID ItemWeight
> 10 -1
> 11 0.3
> 12 1
> 13 -0.2
> Relationships TABLE:
> Item1 Item2 linkweight
> 11 10 0.1
> 12 10 0.42
> 12 11 0.5
> 13 10 0.33
> 13 12 -0.33
> For Item 13:
> Correct set: 13, 10, 11, 12
> Notice that direct related are 13 and 10
> Items related to 10 are 11 and 12
> Your first suggestion, gives empty,
> the second one, gives 2 records: 13,10 and 13,13
Ah! You have a hierarchy. ML gave one solution. For another solution, read
these articles about using nested sets:
http://www.mvps.org/access/queries/qry0023.htm
http://www.dbmsmag.com/9603d06.html
http://www.intelligententerprise.com/001020/celko.shtml
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Sunday, February 19, 2012

how to hook into sql server with vbscript or C# ?

How can I do this with vbscript, or C# ?
- Copy backup files down from a network share, into the data directory of my
local sql 2005 instance
- perform a restore using the files copied from above
- Execute a dts package
More info:
Our databases are scripted and exist on the typical development, and testing
enviroments. So as I get ready to start a new application, I want my local
sql instance to be updated based on structure changes as well as data. So I
have to apply the changes from the scripted sources and pull over the data.
I would naturally like to automate this.
ideas / suggestions welcomeHello bitshift,
Three thoughts:
a. Use Visual Studio Team Edition for the Database Developer (aka Data Dude)
since it has this "in the box"
b. Look at tools like Red-Gate's SqlCompare.
c. If you insist on rolling your own (which is doable, but a lot of work),
investigate the Server Management Objects namespace in BOL (see "Getting
Started in SMO").
Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/|||"Kent Tegels" <ktegels@.develop.com> wrote in message
news:18f2bcb127c088c9d58e6fc9fc70@.news.microsoft.com...
> a. Use Visual Studio Team Edition for the Database Developer (aka Data
> Dude) since it has this "in the box"
this isn't in my MSDN subscription except as a trial; do you know if
there's any way to get hold of it for less than the $3700 or so Programmer's
Paradise wants ?
is it an add-on that I could put on top of VS2005 or a completely separate
product? how does it compare to the Redgate tools ? where there's a
comparision of course ..|||Are you trying to do a custom log shipping? If you are, check out my blog
entry (this of course doesnt include the DTS portion) ;-)
http://bassplayerdoc.blogspot.com/2007/10/your-poor-mans-sql-server-log-shipping.html
"bitshift" <jobob@.aol.com> wrote in message
news:Obd7Kj5BIHA.5980@.TK2MSFTNGP04.phx.gbl...
> How can I do this with vbscript, or C# ?
> - Copy backup files down from a network share, into the data directory of
> my local sql 2005 instance
> - perform a restore using the files copied from above
> - Execute a dts package
>
> More info:
> Our databases are scripted and exist on the typical development, and
> testing enviroments. So as I get ready to start a new application, I want
> my local sql instance to be updated based on structure changes as well as
> data. So I have to apply the changes from the scripted sources and pull
> over the data. I would naturally like to automate this.
> ideas / suggestions welcome
>

How to HIDE SQL Server on LAN?

Hi everybodyIn my web application I am using SQL Server 2000. But as we all know, its presence in the network is visible to all the clients in the network. Anybody who has SQL Server client installed and knows the password of the database would be able to access DB remotely and this is what I don't want. I want user to access my database only when they are loggedon on physically (directly) on the machine on which SQL Server is installed.Your replies are awaited.Thanks in advance.Regards,Zulfiqar Dhuka

Go to Sql Server Enterprise Manager.
1. Expand Sql Server Group.
2. Select Server Node (local)
3. Right Click Select Properties, then select Security tab.
4. Select Authentication to Windows only, then OK