all groups > sql server programming > april 2006 > threads for sunday april 16
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Bday dates revisited
Posted by Mike_B at 4/16/2006 10:17:04 PM
Hi,
I'm trying to create a query that will tell me when someone's birth day is
approaching from my employee table. I tried Case When
Datediff(dd,b_day,getdate()) < 4 Then 'Remind' Else '' End As B_dayCk
Datepart(dd,b_day) - Datepart(dd,b_day) < 4 (This checks for the day but not
for the ... more >>
Weird..
Posted by Omnibuzz at 4/16/2006 9:55:01 PM
SQL Server assumes all functions to be deterministic.. is it true??
check this out.
create view vtest
as
select rand() as today
drop function func1
create function func1 (@b varchar(10))
returns float
as
begin
declare @a float
select @a = today from vtest
return(@a)
end
select ... more >>
Add text to paramaterized query result in SQL Server -- is it possible?
Posted by Ranginald at 4/16/2006 7:15:07 PM
Hi,
Question 1:
Say you have a query: SELECT itemID, itemDesc FROM tblItem
that returns the following:
itemID itemDesc
=============
1 Item1
2 Item 2
3 Item 3
Is there a way to add text to this result set. Say for example if you
were using a parame... more >>
query help pls
Posted by Hassan at 4/16/2006 6:46:17 PM
Have this table
Col1 Col2
DB1 Host1
DB1 Host2
DB1 Host3
DB2 Host1
DB2 Host2
DB3 Host2
DB3 Host3
I would like the output to be as such
Host1 DB1,DB2
Host2 DB1,DB2,DB3
Host3 DB1,DB3
.... and so on
How can I do s... more >>
Timeout Expired on SQL 2000
Posted by scott at 4/16/2006 6:43:23 PM
I have SQL 2000 developer running fine on my desktop pc. I'm getting the
below error when trying to connect or register the SQL 2000 server from both
mylaptop and my domain server.
Both my server and laptop are running SQL 2005. I have service pack 4
installed on the SQL 2000 server instanc... more >>
representing months with columns
Posted by PJ6 at 4/16/2006 11:21:54 AM
I keep running into people that represent each month, January through
December, as a column in a table. Considering the nature of some of the
reports generated from this data, storing it in this way can certainly be
convenient; however I personally find the idea repugnant. I've been doing
th... more >>
Syntax error converting datetime from character string.
Posted by rmcompute at 4/16/2006 9:51:01 AM
I input a date and time to charachter variables and tried to convert them to
a datetime variable. I got the error:Syntax error converting datetime from
character string. I was able to successfully convert when I hardcoded those
values directly to the convert function. The first SQL statemen... more >>
When to use stored function Vs. stored procedure?
Posted by keithb at 4/16/2006 7:25:52 AM
How to decide between a stored function and a stored procedure when
functionality can be implemented either way?
Thanks,
Keith
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Condition in FROM vs WHERE
Posted by Senna at 4/16/2006 2:59:01 AM
Hi
What's the difference between having the condition in FROM vs WHERE.
Alt 1:
SELECT t1.Title
FROM Table1 t1 INNER JOIN
Table2 t2 ON t1.Id = t2.Table1Id
WHERE t1.Active = 1
Alt 2:
SELECT t1.Title
FROM Table1 t1 INNER JOIN
Table2 t2 ON t1.Id = t2.Table1Id ... more >>
select * in views
Posted by Peter at 4/16/2006 12:22:39 AM
People are telling me it is bad to put
select * from <atable>
in a view. I better should list all fields of the table inside the
definition of the view.
I dont know exactly why but some say:
A select * from makes sql server does a table scan.
Is that true, even if i put a where... more >>
Performance problem
Posted by Roy Goldhammer at 4/16/2006 12:00:00 AM
Hello there
I have two tables with combination of two fields that aren't unique in both
tables.
To make them unique i must, create view of the last id of the fields.
example SELECT Fld1, Fld2, max(id)
FROM tbl
GROUP BY Fld1, Fld2
This cause serious performace problem.
Is there a wa... more >>
wrong result set
Posted by Peter at 4/16/2006 12:00:00 AM
Hello all,
I have the following t-sql batch:
create procedure stp_test
(
@p_date1 as datetime = null,
@p_date2 as datetime = null
)
as begin
set @p_date1 = isnull(@p_date1, <some expression>)
set @p_date2 = isnull(@p_date2, <some other expression>)
select
... more >>
|