473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using host_name(): Crossing my fingers...

I did this thing with host_name(). I'm hoping someone can tell me if
I'm gonna get into trouble with this scheme before it's too late...

I have maybe 75 users.
They all call on a table of appointments (many thousands) and I dump
the ones being viewed into a temp table named TaskTEMP.
I am using a custom function within a View to grab a bunch of rows in
one table and slap them into a single column on the records returned
by the view.
Here's where I'm concerned-
When I insert the records into the TempTable I insert the value
HOST_NAME() into every row of a column named myMachine.
So the row looks like:

TaskID aName myMachine
1234 Jim Smith Dell101
1235 Fran Jones Dell101
1235 Mary Cat Dell101

When I run the view, I get:

TaskID myNames
1234 Jim Smith
1235 Fran Jones, Mary Cat

What I'm concerned about is when user 2 is looking at the same record
at the same time and inserts the following into TaskTEMP:

1234 Jim Smith CompaqXYZ
1235 Fran Jones CompaqXYZ
1235 Mary Cat CompaqXYZ

I use the HOST_NAME()filter in the example below to deal with this so
that both user one and user two get what they want instead of:

TaskID myNames
1234 Jim Smith, Jim Smith
1235 Fran Jones, Mary Cat, Fran Jones, Mary Cat

It works great in testing. The obvious problem is if two users have
the same machine name, but in this installation business rules prevent
that.
I hope someone can either validate this approach or improve or trash
it before it gets too late with this project.
thanks.
lq

The view and function look looks like this:

SELECT TaskID, dbo.fn_myNameGroup(TaskID) AS myNames
FROM dbo.TaskTEMP
GROUP BY TaskIDID

The function looks like this:

CREATE function dbo.fn_myNameGroup(@TaskID as int) returns
nvarchar(500)
as
begin
declare @ret_value nvarchar(500)
SET @ret_value=''
Select @ret_value=@ret_value + '; ' + aName FROM TaskTEMP where
TaskID=@TaskID AND myMachine=HOST_NAME()
RETURN RIGHT(@ret_value,LEN(@ret_value)-2)
end
Jul 20 '05 #1
3 3371
In article <47**************************@posting.google.com >,
la*************@hotmail.com says...
I did this thing with host_name(). I'm hoping someone can tell me if
I'm gonna get into trouble with this scheme before it's too late...

I have maybe 75 users.
They all call on a table of appointments (many thousands) and I dump
the ones being viewed into a temp table named TaskTEMP.
I am using a custom function within a View to grab a bunch of rows in
one table and slap them into a single column on the records returned
by the view.
Here's where I'm concerned-
When I insert the records into the TempTable I insert the value
HOST_NAME() into every row of a column named myMachine.
So the row looks like:


Why do you care what machine they are at? Why not just return their
information using their logon ID (not a NT account, but you app should
have them logon (database table lookup) and then you don't have to do
any of that.

--
--
sp*********@rrohio.com
(Remove 999 to reply to me)
Jul 20 '05 #2
> I did this thing with host_name().

I normally use #temp tables.
The data in the table will be private to a each connection.

EG

CREATE TABLE #Temp( MyInfo VARCHAR(255))
GO

INSERT #Temp .....

Jul 20 '05 #3
Lauren Quantrell (la*************@hotmail.com) writes:
It works great in testing. The obvious problem is if two users have
the same machine name, but in this installation business rules prevent
that.
Maybe. Beware that host_name() is provided by the application, through
the connection string, and an application may not provide it all. Or
may provide bogus information.
CREATE function dbo.fn_myNameGroup(@TaskID as int) returns
nvarchar(500)
as
begin
declare @ret_value nvarchar(500)
SET @ret_value=''
Select @ret_value=@ret_value + '; ' + aName FROM TaskTEMP where
TaskID=@TaskID AND myMachine=HOST_NAME()
RETURN RIGHT(@ret_value,LEN(@ret_value)-2)
end


Beware that the result of this function is undefined. You may get
the desired result, but you may get something else. The only safe
way is to iterate over the data. See also
http://support.microsoft.com/default.aspx?scid=287515.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
by: Dick Moores | last post by:
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, <http://mathworld.wolfram.com/Base.html>, but I really don't understand it well enough....
10
by: Ryan McGeary | last post by:
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new <optgroup>. Using the example below, notice how...
20
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
4
by: Nick Stansbury | last post by:
Hi, I have a question regarding host_name() and IP addresses of clients. I'm running on a shared server - so access to xp_cmdshell is barred which is the standard response to questions about...
2
by: Chuck | last post by:
I am using an asp.net page and I am trying to setup a customers website. The website uses a ssl certificate from verisign and the customer would like to use the seal. The new style from VeriSign is...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
2
by: Laurent Navarro | last post by:
Hello, I created an application with the FrameWork 1.1 containing differents forms and threads runing. There was no problem, I could click on a picture on my Main Form to call the Show()...
0
by: mccle27252 | last post by:
cracked skin on fingers http://cracks.00bp.com F R E E
1
by: yaFaheem | last post by:
This is my first exposure to perl Mech when I am trying to autofill a php script. As per perl Mechaize docs, there are numerous functions to fill out a text field and submit. However, what if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.