|
I want to take an IP address e.g. 111.222.333.444 and convert it to either a float or an unsigned datatype.
Thanks,
|
|
|
|
|
Why? An IP address is really a string of numbers - not a number. Removing the dots won't help because you really don't know where to put them back. I suppose you could always store it as four numbers, but it still doesn't gain you much.
|
|
|
|
|
The reason is for faster search indexing. I found this after I posted;
Create FUNCTION [dbo].[Dot2LongIP]( @IP VarChar(15) )
RETURNS BigInt
AS
BEGIN
DECLARE @ipA BigInt,
@ipB Int,
@ipC Int,
@ipD Int,
@ipI BigInt
SELECT @ipA = LEFT(@ip, PATINDEX('%.%', @ip) - 1 )
SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipA) - 1 )
SELECT @ipB = LEFT(@ip, PATINDEX('%.%', @ip) - 1 )
SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipB) - 1 )
SELECT @ipC = LEFT(@ip, PATINDEX('%.%', @ip) - 1 )
SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipC) - 1 )
SELECT @ipD = @ip
RETURN ( @ipA * 256*256*256 ) + ( @ipB * 256*256 ) + ( @ipC * 256 ) + @ipD
END
RETURN @ipI
END
This does speed it up and seems to meet my needs.
Thanks,
|
|
|
|
|
hi
i have table that have id file, and i want that only one value will
apir in arecord.
my table
========
123
333
444
123
444
123
what i need
===========
123
333
444
thank's alot
|
|
|
|
|
i work in access 2007
name of the table: men
name of the fild : id
|
|
|
|
|
Are the rest of the values on the row different like this? Are you just trying to get a list of DISTINCT ColumnA values?
ColumnA ColumnB
-----------------
123 ABC
222 ABD
123 ABF
222 SDS
|
|
|
|
|
Use a SELECT DISTINCT query to fetch unique values from a table.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
wht u want to do?...while retrieving or in the table itself?....
|
|
|
|
|
Hello,
I have been working for two weeks on a problem to get data out of a database in a meaningful format. The database consists of basic server information along with information on some users, websites, and applications. The database structure is as follows:
Tables: Server Users Applications WebSites
Fields: ServerName ServerName ServerName ServerName
IPAddress UsrName AppName SiteName
Alive
ADsPath
dateAdded
datePwdChanged
I am trying to build a query/report that will give me information in the following format:
ServerName1 IPAddress Alive ADsPath dateAdded datePwdChanged AppName1 UsrName1 SiteName1
AppName2 UsrName2 SiteName2
AppName3 UsrName3 SiteName3
AppName4 SiteName4
AppName5
ServerName2 IPAddress Alive ADsPath dateAdded datePwdChanged AppName1 UsrName1 SiteName1
AppName2 UsrName2 SiteName2
AppName3 UsrName3 SiteName3
AppName4
and so on. (Tried to get the formatting right on here, but not sure it displays completely accurate).
So far, I get either a query showing servernames multiple times with multiple application, user and site entries or I get nothing.
I have googled everything I can think of and have run out of places to look. I have tried googling on what I want it to look like, how I think it should be queried, all to no avail. Obviously, I would be grateful if someone had a magic bullet for this, but at least pointing me in a new and valuable direction would be hugely appreciated.
|
|
|
|
|
Use a table (fixed or not) to keep this report-like data and populate it using a stored procedure.
Nuclear launch detected
|
|
|
|
|
I am assuming that I would need to create a one-to-one column relationship with the server table columns, however, for the apps, users, and websites, would I create a memo/text field and then concatenate all of the entries to show in there?
I am not as familiar with the intricacies of SQL and using stored procedures to get something like this done.
|
|
|
|
|
Hi Jon
Your problem can most-easily be solved at a presentation-level, rather than at a SQL level. Under MS-Access, you would define a report that lists just your servers. Then embed 3 sub-reports (for each of your other tables) linking to the server. Most other reporting tools offer similar sub-report facilities.
If you do need to solve it using SQL-Server then your will need to use a stored procedure and a bunch of cursors.
Regards
Andy
|
|
|
|
|
Actually, this makes much more sense. I don't have to do it in SQL. I just need the information in a format that is easily read and makes the most sense for the project.
|
|
|
|
|
Hi,
How do I get the diagrams to print smaller on a page? It's those diagrams that display the tables with their relations to other tables. Currently the tables are printed huge and there is a lot of white space in between.
Are there any better 3rd party tools that can create better diagrams?
Regards,
Brendan
|
|
|
|
|
.NET Enthusiast wrote: Currently the tables are printed huge and there is a lot of white space in between.
Have you tried rearranging them closer together?
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
Hi,
I have searched Google for performance tips but didn't find many because I didn't understand. If any one has a good readable topics please forward it to me.
If I changed int to smallint can this also result in better performance?
Thanks
Brendan
|
|
|
|
|
Hi Brendan
Changing an "int" to a "smallint" is unlikely to make much of a difference.
Putting decent indexes in place will normally yield a quick-win for performance.
Pete O'Hanlon put together these articles[^] about performance optimisation.
Regards
Andy
|
|
|
|
|
I want to know which stored procedures are executed in the last 24 hour in my database and i wish if i could also know about the program who called the stored procedure?
OR
I can know about a specific stored procedure that when it was executed last time and by which program?
Please help...its urgent?
Regards,
Zeeshan Malik
-- modified at 12:21 Monday 26th November, 2007
To do what can be done is a Intelligent Job and to do what should be done is a Genious Job
done is a Genious Job
|
|
|
|
|
You need to look at using SQL Profiler to identify what's going on down at the database level. It won't tell you exactly which program calls the SQL, but it will tell you what SQL is hitting the database and who is doing it? Take a look at this[^] article for details.
Now a request - please don't put it's urgent in a post. They are all urgent to somebody, and this doesn't help anybody.
|
|
|
|
|
hi all,
Is it possible to install SQL Server 2000 on Vista Home Premium ? coz whenever I go to install it on my laptop pre-installed with Vista Home Prem, at certain point in insatllation process it isays "Windows installer has stopped working" and there after, the insatllation exits, whereas on my XP machine it installs just fine ? plz help?
|
|
|
|
|
|
thanks man...atleast now i know for sure that no matter what i do, i wont be able to install SQL SErver 2000 atleast on Windows Vista.
well, i do have another query, if u could help me with this, Is there any problem if i go to format the hard disk and install Windows XP instead of Windows Vista on my laptop? actually my laptop came with Windows Vista Home Premium pre-installed, but due to some application compatibility issues i want to remove that and install XP.
Can i go ahead with the regular process of installing an OS or is there any special care I need to take? Plz help
|
|
|
|
|
hi i am using asp.net 2005 to create an website which handles data from ms sql.
i am trying to create an stored procedure which would call an function from the asp.net function when an event(e.g when data in an perticular table is changed) i have read some tutorials on stored procedure however they dont really cover what i need
so could anyone help me? maybe some good tutorial recommandation or source code or recommandation?
|
|
|
|
|
neodeaths wrote: i am trying to create an stored procedure which would call an function from the asp.net function when an event(e.g when data in an perticular table is changed)
This doesn't make sense. You want to write a proc which calls code in your ASP.NET app ? You can define a trigger, and you can use managed code in SS2005, but even then, the code is going to be atomic, I doubt it can fire events in your code, especially as, in an ASP.NET app, the class instances that exist change every time a page is loaded, and are active only while it is being created.
Perhaps if you try to explain a little better ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi i am using vs 2005 and doing an asp.net website
i created a basic db and drag and drop the table into my web page until now it works fine
however i realise that everytime i change the table infomation the web site table which is displaying the db infomation does not refresh
hence i am trying to find a way to resolve this issue.
please voice ur suggestio and opinion to me
|
|
|
|