I have three tables
Table1
col1, col2
Table2
col1, col2
table3
col1, col2, col3
col2 of table2 is a foreign key refering tabl1(col1)
col2 of table3 is a foreign key refering table2(col1)
I want to get for each col1 in table1, how many distinct values of col3 are there in table3
I tryed...
Hi,
I have three table
say
tbl1
col1 col2
1 1
2 1
3 2
4 3
tbl2
col1 col2
1 aa
2 bb
tbl3
col1 col2
1 dd
2 ee
3 ff
col2 of tbl1 is a foreign key refering to col2 of both tbl2 and tbl3
I want to...
I was trying to convert this query to ansi standard join statemet, but it is not giving the same record set waht did I miss
<html>
<head>
<title>query that should be converted</title>
</head>
<body>
SELECT eae.EAE_SES_ID
FROM PHOENIX.EXPEDITED_ADVERSE_EVENTS EAE
WHERE...
I have a query and, no matter how many indexes I have added I can't remove the clustered index scanning
what do you suggest
below is the show plan text
|--Filter(WHERE:(((((((([@p_In_EVT_LAST_CHANGED_USER_ID_Num]=NULL OR...
I have this query
The table PHOENIX.EXPEDITED_ADVERSE_EVENTS has clustsed index defined on EAE_ID and nonclustsred index defined on EAE_NUMBER
SELECT EAE_ID FROM PHOENIX.EXPEDITED_ADVERSE_EVENTS
WHERE CAST(EAE_NUMBER AS VARCHAR(15)) LIKE ISNULL(NULL, CAST(EAE_NUMBER AS VARCHAR(15)) )
when I...
what is a substitute for covering index in sql server 2000
There are many columns which are causing clustsred index scan that degrades my query performance
here is part of the showplan in my query
|--Clustered Index Scan(OBJECT:([DaidsesDev4].[Phoenix].[EAE_DIAGNOSTICS].[EDI_ID_PK])...
I have created a nonclustsred index on a column of a table that is refered in on stataement of a inner join statement;
but it is still going clustsred index scan,
what is the reason behind this and how can I solve this
Thanks
I have a table say
tbl
col1 col2
1 A
2 B
3 C
Null F
5 G
Null H
Here is what I want a parameter is passed to my stored proc
@col1 int = Null
I want to select a value from tbl1 according to @col1
if @col1 is null I will select all the records of tbl...
I have a local variable say @var
I want to select some data from a table XY based on the values of these local variable. The values for the local variable can be NULL or have data
Here is what I want, I want to write a single query to select data from the table only if the variable is not null...
Given this table
col1 col2
1 yes
1 no
2 yes
2 yes
3 no
3 no
4 yes
4 no
I want to query out that for each value in col1 if its corresponding value in col2 is yes, yes - it will be yes,
no, yes - it will be yes, no, no it will...
I have a parent and child table
for each record in the parent table there are multiple corresponding records in the child table
I want to query out the latest data from the child table for each record in the parent table
how ca i do that
remember the parent and child table have a foreign key...
I want my dynamic sql to return one result set on a variable
declare @string varchar(400), @result varchar(400), @columnName varchar(400)
set @string = 'select ' + @result + '= ' + @columnName + 'from ' + @tableName
exec(@string)
select @result
This query is not working, any suggestion?
My datacase is sql 2000,
I am trying to join the tables with a datatime column. It tiime outs, I am trying to optimize this issue.
if I create a nonclustered index on this, does this help
or what is the best solution for this problem
thanks
I want to move a clustsred index from a primary key of a table to another key
how can I do this,
if I move it, does it affect other tables if hey have foreign key relation to this table
Thanks
I want to rename all stored procedures in my database
eg if the procedure's name is proc I want to rename it like dbo.proc
I want to do it to all my procedures in my database.
How can I do this with a single query
Thanks
I am a bit stuggering to do this
here is my problem
I have table lets say tbl it has two columns with produciId numeric and version varcahr(40)
here is the table
tbl
productId version
1 0.0
1 1.0
1 2.0
2 2.0
3 0.0
3...
All,
I am confused what to do
I have a parent table and more than 40 child tables for this table.
I am tracking a change on these table,
If a change is done on one of the tables either it is the parent or a child, I will update a column in the parent table
Here is what I did, I defined a...
does trigger fires itself?
here is the senario
I am going to create a trigger on a table that fires when the tables is updated.
but I am going to update the same table inside the trigger?
does this fire the trigger again and causing infinite firing of the trigger and updation of the table
thanks
can you suggest on this procedur to improve its performance
--procedure
@SessionGUID UNIQUEIDENTIFIER,
@ReportId int,
@SelColumn_STUDY_NUMBER varchar(1),
@SelColumn_SVB_TO_BE_VERSION_NUMBER varchar(1),
@SelColumn_INDNumber varchar(1)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.