|
i had similar problem, unable to connect to sqlserver from query analyser or other application (cilent & server diff machines)
after creating an Alias to server machine using "Client Network Utility" of SQL Server able to crack this problem.
Hope this will solve your problem also
|
|
|
|
|
Hi,
I tried like that also but no luck.
Thanks,
J.ASwani kumar
|
|
|
|
|
I have a table where each row list's the product id and then 9 individual statistical percentage value relevant to that product. I need to create a final column to average all percentages into one overall score as well.
Any suggestions on how to do this?
The main select part of this code is below. Thanks in advance
SELECT ProductID, <br />
-- Calculate Speed percentage<br />
CONVERT(decimal(18, 2), @BestSpeed / (SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) * 100) As [Speed],<br />
--Actual speed value<br />
(SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) As [Actual Speed],<br />
-- Calculate APR value percentage<br />
CONVERT(decimal(18, 2), @BestAPR / (SELECT AVG(APR) FROM Leads WHERE APR IS NOT NULL AND ProductID = P.ProductID) * 100) As [APR],<br />
-- Actual APR value<br />
(SELECT AVG(APR) FROM Leads WHERE APR IS NOT NULL AND ProductID = P.ProductID) As [Actual APR],<br />
-- Calculate Broker Fee percentage<br />
CONVERT(decimal(18, 2), @BestBrokerFee / (SELECT AVG(BrokerFee) FROM Leads WHERE BrokerFee IS NOT NULL AND ProductID = P.ProductID) * 100) As [BrokerFee],<br />
-- Actual APR value<br />
(SELECT AVG(BrokerFee) FROM Leads WHERE BrokerFee IS NOT NULL AND ProductID = P.ProductID) As [Actual BrokerFee],
|
|
|
|
|
Try
select A.*,
([Speed] + [Average Speed] + ##Others##) / 9 AS FinalAverage
from (
##Your SQL goes here
) A
order by ProductId Your original SQL is used as an "inline view". The average is the total of your 9 columns, divided by nine.
Regards
Andy
|
|
|
|
|
I don't think I made myself completely clear. I do not have a table in my database with the statistics in them. I have a large query that is building these stats up as I go, for each row. What I want to do is average up these created values once the row is has all but finished. This should be the final column.
The code your provided does the correc thing but I need to know how to get the values from the row I am creating, rather than from a table in the database?
Any ideas?
Thanks
|
|
|
|
|
If you insert you original select statement where I indicated then you will find the the resultset contains all of your columns (thats the A.* bit), followed by your new average.
|
|
|
|
|
i am trying to install sql server 2000 standard Edition on Windows server 2003 but at the configuration time during the installation, Configration error message is shown pointing to "C:\windows\sqlstp.log". when I open this file it contains the following messages in the bottom. and setup exits.
Sql Server Log
##############################################################################
Starting Service ...
SQL_Latin1_General_CP1_CI_AS
-m -Q -T4022 -T3659
Connecting to Server ...
driver={sql server};server=NICOPDB;UID=sa;PWD=;database=master
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
driver={sql server};server=NICOPDB;UID=sa;PWD=;database=master
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
driver={sql server};server=NICOPDB;UID=sa;PWD=;database=master
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
SQL Server configuration failed.
###############################################################################
|
|
|
|
|
Install MDAC 2.8 and then install SQL Server...
Regards,
Smart Boy
Mumbai,
(INDIA)
|
|
|
|
|
Thank You for reply. I will try it out
|
|
|
|
|
hi,
i want to insert few values in a table of which some should be null.
how can i assign the null value at the code level itsellf?
example i have few variables and one of the variable should be a null value and this variable will be later passed as a input parameter to a sp
Gautham
|
|
|
|
|
|
for example i have parameter name param1 for a sp and now normally we have to assign a value to this param1 like param1.value="some value" here i want to give a null value
Hope iam clear!!
Gautham
|
|
|
|
|
Use DBNull.Value in .NET to pass NULL to the database.
|
|
|
|
|
Thanks!
Gautham
|
|
|
|
|
SELECT ProductID,(@BestSpeed / (SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) * 100) As [Speed],<br />
FROM Products P
The following code retrieves an integer, Product ID, and another field, Speed. How do I know what datatype speed is and how can i change it? It returns a percentage value but currently I am getting, for example :45.5621301775148. Presumably this is a float. I would prefer say Decimal(18,2)
Thanks
|
|
|
|
|
can us Convert function
SELECT ProductID, CONVERT(decimal(18, 2), (@BestSpeed / (SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) * 100)) As [Speed],
FROM Products P
i've used same on strings for converting to number / date
but not for numeric
|
|
|
|
|
CONVERT(decimal(18, 2), @BestAPR / (SELECT AVG(APR) FROM Leads WHERE APR IS NOT NULL AND ProductID = P.ProductID) * 100) As [APR]
The following seems to work fine. Thanks
|
|
|
|
|
hi ,
well thats what JIT says everytime i run an sql server 05 express sample on my pc.Somehow the code that i write for the dbs i've made runs fine. But every sample ive got , including samples from MSDN give me that error.
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
Could someone perhaps tell me how to enable remote connections!? I'm quite a newbie with sqlserver.
thanks
Gideon
|
|
|
|
|
giddy_guitarist wrote: well thats what JIT says everytime i run an sql server 05 express sample on my pc
If you refer to the SQL Server using some form of network naming convention it will attempt to connect with TCP/IP which is, for security, turned off by default.
e.g. The connection string says: Server=localhost it will attempt to connect via IP address 127.0.0.1 (the loopback adapter)
Try Server=(local) as that will attempt to use a (I think) shared memory connection which doesn't go through any network adapter.
|
|
|
|
|
Take a look at SQL-Server's "Surface Area Configuration" tool. By default SQL-Server 2005 doesn't allow connections from remote machines. You need to explitely change this setting.
|
|
|
|
|
He says he is running "an sql server 05 express sample on my [his] pc". Thus he does not need to open anything to the outside world as all parts are running on the one PC. The question appears to be a false lead, driven by the error message.
|
|
|
|
|
|
giddy_guitarist wrote: This is the connection string in the config file:
connectionString="Data Source=ONTEORA-PH0OA8I;Initial Catalog=Northwind;Integrated Security=True"
I added Server=localhost and Server=(local). Nothing.
Data Source and Server are synonyms. Pick either Data Source or Server and stick with it. I suspect Data Source trumps Server , and because you are referring to your PC by name it is attempting to use a network connection.
|
|
|
|
|
i got the sample working.
Could you just help me out with the following:
I now need a connection string that loads a database thats in the same directory as the .dll , .exe
When i connect to my database in the server explorer and check the property window , the connection string reads:Data Source=.\SQLEXPRESS;AttachDbFilename="E:\Gid\Hotel Management Studio\HotelManager.Core\DataServices\HTLDATA.mdf";Integrated Security=True;User Instance=True
Now , if i use this in SqlConnection() it works fine. Now if i change AttachDbFilename=HTLDATA.mdf. . .and then copy the .exe and the DB into another location . .it doesnt work saying "A dbase with the same name exists or the file cant be open" . So i cant copy my database and use it on the same pc? but then VS itself copies my database from the Project folder into the bin.
I found this site:http://www.connectionstrings.com/?carrier=sqlserver2005
The last section has .NET connection strings , i tried:
Attach a database file on connect to a local SQL Server Express instance
Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
But this doesnt work too. Whats dbname? I tried HTLDATA(.mdf)
What sring should i use?
|
|
|
|
|
Hi!
I have three Columns. Category, Type and Item. How would I write a stored Procedure to take values in those three columns and combine them into one column?
So instead of having Category = Test, Type = Test and Item = Test, you will have one column with all the values like: Test / Test / Test.
Thanks!
Illegal Operation
Making Computer Software Talk
|
|
|
|