|
It runs distinct on the set before returning it from the query.
You can see this using execution plans.
|
|
|
|
|
How can I create RowID auto incremented while selecting datafields from table but RowID does not exist in table.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
SQL Server 2005
SELECT ROW_NUMBER () OVER (ORDER BY Column Name) AS Rowid FROM tablename
Where Rowid will retrieve the row number based on the columns.
Otherwise you a number table and join to that - and before you ask, try Google e
Bob
Ashfield Consultants Ltd
|
|
|
|
|
HI
how can I calculate diffrence between 2 datetime variables in terms of days only.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
select datediff(d,'01 jun 2006',getdate())
Have you ever used SQL? Your questions are very very simple. Try the SQL Server HELP before posting, it will save you time!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
How to use inner join in 3 tables?
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
select col...
from table1
inner join table 2 on ...
inner join table3 on ...
Or in other words just like inner joining any number of tables.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
syntax to create function on remote server(sql server 2000)
this is my function:-
Create Function ReturnAmount(@CMID int) Returns Decimal
as
BEGIN
declare @Return decimal
select @Return =sum(PD_PaymentAmount) from Payment_Details where
PD_IsRefund=1 and PD_PaymentType=1 and PD_CMID=@CMID
return @Return
END
but on run error occurs:-
Incorrect syntax near 'Function'.
A RETURN statement with a return value cannot be used in this context.
|
|
|
|
|
Have yuo got anything in the script before it? Create Function must be the first thing in the script. Also you do not want return @Return, you just want RETURN
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
No do not have any script before it i have tried with only "Return" too but still giving errors:-
Incorrect syntax near 'Function'.
Must declare the variable '@CMID'.
|
|
|
|
|
Create Function ReturnAmount(@CMID int) Returns Decimal
as
BEGIN
declare @Return decimal
select @Return =sum(PD_PaymentAmount) from Payment_Details where
PD_IsRefund=1 and PD_PaymentType=1 and PD_CMID=@CMID
return (@Return)
END
should do it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i have used but same errors
|
|
|
|
|
Well I'm at a loss then. It works for me on both SQL Server 2000 and 2005. Are you sure when you copied it none of the line breaks got lost?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ya sure no lost of lines its working on local server but not on remote server
|
|
|
|
|
Dear Friends I have installed SQl Server 2005 on windows xp sp2 but when i add SQL Native Client in ODBC i get the following message
SQLState: '8001'
SQL Server Error: 126
[Microsoft][SQL Native Client]VIA Provider: The specified module could not be found.
Connection Failed:
SQLState: 'HYT00'
SQL Server Error: 0
[Microsoft][SQL Native Client]Login timeout expired
Connection Failed:
SQLState: '8001'
SQL Server Error: 126
[Microsoft][SQL Native Client]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.
TESTS FAILED!
Please guide me as to what can be done to solve the problem
i am not able to connect through the application developed in vb.net.
thnxs.
|
|
|
|
|
You probably don't have the VIA (Virtual Interface Adapter) hardware required to use the VIA protocol. You can force the network library to be used by specifying "Network Library" in the connection string - for example, TCP/IP is 'dbmssocn'.
If you're using VB.NET to connect to SQL Server you should use the SqlConnection class and its family of associated classes, not ODBC.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks,
but sql is not configured in ODBC Manager so I cannot connect to sql server. So how should i configure sql in odbc manager.
and when i tried to configure it it was giving me the error as quoted in the query.
How should i solve it.
|
|
|
|
|
Hi,
I do not know if this is the right place to post my question. Please refer me to the appropriate place if this is not it.
I set up a report server and created some rdl reports using .net. I published them successfully, now I would like to setup the subscriptions. When I read through the msdn and other articles on how to configure the report server for e-mail delivery, I did everything except for this:
"Verify that the Report Server Windows service has Send As permissions on the SMTP server." Can anyone please tell me how do I do this.
Thanx
|
|
|
|
|
In my current application I am getting an error "Cannot insert duplicate key row in object with unique index .\r\n51062\r\nThe statement has been terminated." while trying to run the command sqlCommand.ExecuteNonQuery();
Please advice me if anyone has any idea on this.
Thanks & Regards
Mishra
|
|
|
|
|
Well, the error message seems pretty clear to me.
You are trying to insert rows which have a duplicated key in your table/database.
Avoid doing that, or remove/change the key if you need duplicated values.
|
|
|
|
|
You allready got answer from error message.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
hi
how can i transfer database from Magic to SQL server ?
thanks
|
|
|
|
|
Maybe I am the only one who doesn't know it, but what is 'Magic'?
|
|
|
|
|
i have the Following Query, i would like to know how can i use Distinct from this Query based on Property_ID Field, but i dont the order of my Field to Change, because there are Duplicates.
SELECT REC_NO,LIS_KEY,FUNC_KEY,UNIT_NO,RIGHTS_ZONING,USE_CODE,OWNER,RATEABILITY,
EXCLUSION,MARKET_VALUE,EFFECTIVE_DATE,CATEGORY_CODE,SUPPLE_NUM,AREA,PROPERTY_ID,
OLD_MARKET_VALUE,VALUATION_ID,REASON,SORT_DATE
FROM SDE.EXPORT_OITPS_GV_TEST
GROUP BY REC_NO,LIS_KEY,FUNC_KEY,UNIT_NO,RIGHTS_ZONING,USE_CODE,OWNER,RATEABILITY,
EXCLUSION,MARKET_VALUE,EFFECTIVE_DATE,CATEGORY_CODE,SUPPLE_NUM,AREA,PROPERTY_ID,
OLD_MARKET_VALUE,VALUATION_ID,REASON,SORT_DATE
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|