|
santhoshmohan wrote: some wierd numbers
Define "weird numbers"? How is one number any more or less weird than another. For example, is 8 more or less weird than 17? And what about 42? How weird is that?
|
|
|
|
|
Hi all,
I would like to know something about performance tuning.
My doubt is I have A stored procedure for selecting data from a traxn' table.In that SELECT command, i want to invoke a UDF(find its count or sum like...).
Is it affects the perfomance of selecting data from DataBase???
Thnkx in advance
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
I would suggest you could have first glimpsed at the various typographical and lexical gaps in the post that you have made.
1) Even whilst mobile phones are now equipped with state-of-the-art dictionaries to dissuade user from cryptic ambiguous text messaging, there seems to be a little-to-more ambiguities over here:
Vipin dev wrote: traxn'
Vipin dev wrote: Thnkx
Did it mean 'HIGH VOLTAGE <small>TRACTION</small> ' or 'TRANSACTION '?
|
|
|
|
|
Sorry Mr.Vasudevan
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Using a UDF within a stored procedure can have negative performance effects as it must run for every record it pulls form the database.
|
|
|
|
|
Hi , here's my query result.
I want to filter out the column with NULL values. How can I do it ?
Dept Name Newyork LA Washington City1 SanFrn City2
Department1 0 0 0 NULL 1 NULL
Department2 4 0 0 NULL 2 NULL
Department3 0 0 0 NULL 0 NULL
Thanks in advance,
|
|
|
|
|
SELECT DeptName,ISNULL(NEWYORK,0),ISNULL(LA,0) from MYTABLE WHERE....
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Dear Vipin dev,
Actually, I just want to remove the columns with NULL value. If I use ISNULL(NEWYORK,0), the column still in the result set and column name is 0.
Is there anyway I can do it ?
Thanks in advance,
|
|
|
|
|
|
hi check out this
select * from tablename where col is null or col='NULL'
|
|
|
|
|
I think what you want is COALESCE
select COALESCE(fieldname, 0)
COALESCE will select the first non null from a list so you can even have
select COALESCE(field1,field2,field3,field4, 0)
|
|
|
|
|
Hi
How can i check Day Light saving time in sql.
I know there is a inbuilt function called ISDST in C# , but i want that check to be done in Sql procedure.Thanks in Advance
Regards
DilipRam
|
|
|
|
|
|
Hi, all
select convert(varchar,(datediff(dd,'1979-09-04 12:34:50.603',getdate())/365))
here getdate()='2007-09-05 12:34:50.603'
I need find the age of employee but this result is showing 28 instead of 27
because till one day is required to complete 27...
Praveen Kumar
|
|
|
|
|
How are you getting the age, Are you using DATEDIFF ?
|
|
|
|
|
Try something like this for a more accurate result:
SELECT
YEAR(GETDATE()) - YEAR('1979-09-04 12:34:50.603') -
CASE
WHEN DATEPART(dayofyear,GETDATE()) < DATEPART(dayofyear,'1979-09-04 12:34:50.603') THEN 1
ELSE 0
END AS Age
|
|
|
|
|
Why do you use
<br />
<br />
DATEDIFF(YY, @tartdate, getdate())<br />
<br />
<br />
<br />
|
|
|
|
|
Hi
I have table with three columns
col1, col2, col3
i need distinct values of col1 with any values in col2 and col3, eg if data is
1, A, A
1, B, B
2, C, C
i need my query to bring
1, A, A or 1, B, B (only one not both)
2, C, C
i need query for this. i cannot use select dintinct col1, col2, col3 from table due to 2nd row. i am using sql server.
Regards
Shajeel
|
|
|
|
|
Shajeel wrote: I have table with three columns
col1, col2, col3
i need distinct values of col1 with any values in col2 and col3, eg if data is
1, A, A
1, B, B
2, C, C
i need my query to bring
1, A, A or 1, B, B (only one not both)
2, C, C
Don't know which version of SQL Server you are using. If 2000 then below written sql will solve the problem. If you are using 2005 then you can use ROW_NUMBER() instead of IDENTITY() and there is no need for #TempTable. If you are using 2000 and table has a Identity column then also there is no need for #TempTable.
Identity Column or the higher version (2005) will help you to do in single sql stmt...
select <br />
IDENTITY(INT, 1, 1)AS KeyCol, Col1, col2, col3 into #TempTable from tbldistinct<br />
<br />
select col1,col2,col3 from #TempTable B<br />
where (Select Count(*) from #TempTable A where A.col1 = B.col1 and A.KeyCol <= B.KeyCol) =1<br />
<br />
Drop Table #TempTable
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
|
Use a groupby would be the easiest why without DISTINCT
<br />
select col1, col3, col3<br />
from table<br />
ORDER BY col1, col3, col3<br />
|
|
|
|
|
Does someone knows where I find the SQL Ansi specs?
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.(John 3:16)
|
|
|
|
|
|
Hi,
Here is my query.
Select * from Table1
Result
Department NewYork Chicago Washington LA
DepartmentA 1 5 4 0
DepartMentB 2 0 0 3
DepartMentC 0 1 1 1
What I need to do is to get the Top 3 City. ( here Chicago,WashingTon,LA)
Can i filter out the columne with the query ? When I use TOP, it can show top 3 rows.
But, that's not what I want.
Can anybody help me, please?
|
|
|
|
|
RichardBlare wrote: Select * from Table1
I suppose this is you query...and My doubt is
RichardBlare wrote: Department NewYork Chicago Washington LA
Is this your table columns?
RichardBlare wrote: DepartmentA 1 5 4 0
DepartMentB 2 0 0 3
DepartMentC 0 1 1 1
Is this your output?
RichardBlare wrote: Chicago,WashingTon,LA
Is this you want?
RichardBlare wrote: Can anybody help me, please?
If I'm not wrong please tell...Do you need a output that gives you the list of Column names that has maximum values?
If I'm wrong Please explain more clearly what you want...
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|