Viewing 15 posts - 2,581 through 2,595 (of 4,081 total)
Duplicate post. Reply here.
August 20, 2009 at 4:21 pm
If you have to retrieve values from a table, rather than simply test for existence, you probably should use a JOIN. Joins and correlated subqueries produce...
August 20, 2009 at 3:30 pm
In the first instance, it is probably interpreting your constant as a decimal or numeric type.
declare @val decimal (6,2)
set @val = 8493.65
select round(@val,0)
August 20, 2009 at 2:58 pm
Hey Nick,
CONVERT() gives you more control over the format of the output string than CAST().
August 20, 2009 at 2:47 pm
You're welcome, Marcus, and much success to you.
August 20, 2009 at 2:42 pm
Nick, what you are seeing is an example of "parameterized" dynamic SQL. Instead of building the entire string, you can actually pass values into it as parameters....
August 20, 2009 at 1:56 pm
Nick, here is another article by Gail on the topic of SQL injection, which is a hacking technique used against SQL Servers. I'm including it because you really...
August 20, 2009 at 12:53 pm
Okay... I see where you are going wrong. You can't just use a variable to build code and stick it in the middle of code like that, unless...
August 20, 2009 at 12:35 pm
I would like to help but I'm not sure I understand your problem.
What results are you getting currently? Error messages? Null...
August 20, 2009 at 12:31 pm
I'm gonna Fedex Barry a load of frozen pork chops to throw at you guys for laughing at his pain.
(Although I have heard that schadenfreude is...
August 20, 2009 at 12:28 pm
Fair questions. Play around with this for a minute and you will see that it works for other dates than today. Explanations follow.
-- edited to...
August 20, 2009 at 12:16 pm
Guys, I encourage you to give CTEs a try. They act like views which exist only for the duration of a single query. But they read from...
August 20, 2009 at 11:41 am
You might also consider a view or cte that casts all your datetime columns as varchar. You realize of course that you can get no benefits from...
August 20, 2009 at 11:33 am
Actually, your solution is more commonly referred to as a crosstab, not a pivot.
PIVOT is an SQL keyword in 2005 and up.
Why are...
August 20, 2009 at 11:29 am
Does this help ?
--
select getdate() as today
,DATEPART(wk,getdate()) as WeekOfYear
,left(DATEADD(wk,DATEDIFF(wk,0,getdate()),-1),6)+ ' - '
+left(DATEADD(wk,DATEDIFF(wk,0,getdate()),5),6) as weekRange
--
August 20, 2009 at 11:19 am
Viewing 15 posts - 2,581 through 2,595 (of 4,081 total)