|
i have a query in sql2000
if i want to select distinct scid,requirement,comments from table1
i am not getting distinct rows .
distinct keyword is not working .can you please give me some clue.it is urgent.
|
|
|
|
|
My guess is that the DISTINCT keyword is working but that your rows aren't - well - distinct.
|
|
|
|
|
its taking more than two columns combined distinct
|
|
|
|
|
Yes, that is how DISTINCT works. The entire selected row must be identical to others for them to be filtered away.
|
|
|
|
|
Distinct runs on every column after it unless you put the column list in parenthesis () like
SELECT Distinct(col1), col2,col3
you can also group columns in the distinct clause or combine them if they are character strings like
SELECT Distinct (Col1 + Col2), col3
distinct will only operate on the column specified, but in your syntax you are accidently specifying all of the columns, and i imagine that you dont have 2 rows where all 3 columns contain the same data. Oh before i forget, Sql Server 2000's query analyzer tool has the absolute best help under help -> tranact SQL help. it is very well written and has fairly good examples, i use it all the time.
|
|
|
|
|
Do you have text or ntext columns in this table? because as I remember, distinct won't work fine with them.
|
|
|
|
|
can we use stored procedure in user defined function ?????
This is haneef.............................................................
|
|
|
|
|
Have you tried it? If so, and it works the answer is yes else no.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi expets, I created a datagrid column as a templete column.It is a textbox field.So how i validate that templete column(textbox)?
CheeN
|
|
|
|
|
try the C# forum!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I should have guessed, you already did.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i want to create a trigger to copy value inserted to another column on another table i have tried the following but failed.
invoice_summary >> table to copy from
Invoice_details >> table to copy to
create trigger Insert_InvoiceNum on dbo.invoice_summary
for insert
AS
begin
insert into Invoice_details select Invoice_num from inserted
go
regards
|
|
|
|
|
How has it failed?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
error
Server: Msg 170, Level 15, State 1, Procedure Insert_InvoiceNum, Line 5
Line 5: Incorrect syntax near 'inserted'.
|
|
|
|
|
I suspect your InvoiceDetails table has more than 1 column so you need to specify why column to insert the value to
insert into Invoice_details(Invoice_num) select Invoice_num from inserted
Bob
Ashfield Consultants Ltd
|
|
|
|
|
same error raised
incorrect syntax near 'inserted'
|
|
|
|
|
can you post your table definitions? It might be a bit more obvious where the problem is.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Try placing an end before the "go".
Each time you have a BEGIN, you need an END.
|
|
|
|
|
it succeeded
but the insert value affected all rows i want it to affect 1 row only (new row)
hers is trigger syntax
create trigger InsertInvoice on dbo.Invoice_Summary
for insert
As
begin
insert into Invoice_details.Invoice_num select Invoice_num from Inserted
end
go
example :
insert into invoice_summary (P_name) values ('N1')
results:
the row insert to invoice_summary with Invoice_num 80
problem :
all invoice numbers in the invoice_details(invoice_num) is 80
should 1 row only added with that value
regards
|
|
|
|
|
Never overlook the obvious! Good spot.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks .. but still have problem
|
|
|
|
|
|
It depends on many things like nyumber of records, what you are going to do with them etc etc. The best way to find out is to try it - its a quick job to knock up 2 versions of the proc and test it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Trying to install TFS, and after solving a plethora of annoying issues, I've reached an issue that google provides ineffective answers for.
TFS needs to be able to access the WSS, however, WSS needs to be able to configure the DB, providing it with all the neccessary parameters, it (or SQL Server) decides that the service does not have sufficient priviliges, indeed the quoted message reads:
"CREATE DATABASE permission denied in database 'master'. (Error code: 262)"
Does anyone have a clue how to work this out?
Solved, but still TFS won't install
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler
"You're an idiot." John Simmons, THE Outlaw programmer
"I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon
modified on Sunday, June 1, 2008 6:22 PM
|
|
|
|
|