Viewing 11 posts - 46 through 56 (of 56 total)
Rick, it does return the space at the end:
DECLARE @STR NVARCHAR(10)
SET @STR = '1, 2, 3, '
SET @STR = LEFT(@str, LEN(@str)- 2)
select len(@str)
SELECT
September 10, 2009 at 8:13 am
T4FF (7/13/2009)
The coalesce could work, but I can't be sure as to whether the other columns will be blank. Thanks for your suggestions will try each out and see...
July 21, 2009 at 7:45 am
Well, I guess I was off a bit more than I thought I was.
DECLARE @t TABLE (col2 varchar(30));
INSERT INTO @t
SELECT '1,11,2,22,3,33';
; WITH t1 (col2) AS
(
...
June 22, 2009 at 1:35 pm
WayneS (6/22/2009)
Gatekeeper (6/22/2009)
This was answered 2 days ago: http://www.sqlservercentral.com/Forums/Topic738904-338-1.aspxNo it wasn't. Similiar, but yet completely different.
I wouldn't say completely different. All I removed was col1 from the posted code I...
June 22, 2009 at 1:29 pm
What about creating a new user and only assigning it access to views you have written? Then in your view, you can say SELECT '123-45-6789' as SSN, 'First M. Lastname'...
June 22, 2009 at 1:04 pm
This was answered 2 days ago: http://www.sqlservercentral.com/Forums/Topic738904-338-1.aspx
June 22, 2009 at 12:56 pm
Allister Reid (6/9/2009)
insert into @temp select '071009' union select '42209'
select
CONVERT(datetime,
case
when LEN(txtdate) = 6 then STUFF(STUFF(txtdate, 3, 0, '-'), 6, 0, '-')
else...
June 17, 2009 at 10:34 pm
See the last statement to lose the case statements.
DECLARE @Result1 INT
DECLARE @Result2 INT
SELECT @Result1 = MAX(p.Col1) - SUM(CASE WHEN s.Col2 > s.Col1
THEN s.Col2 - s.Col1
ELSE 0
END),
@Result2 = SUM(CASE WHEN...
June 17, 2009 at 10:17 pm
Why not setup profiler to run while you run the "Generate Script" from Studio? That should give you all the needed pieces. Then you would need to replace the "hard...
June 17, 2009 at 2:26 pm
We've been using the ROW_NUMBER() method for a while now and it's great for reporting purposes. Not to mention, its speed is great compared to using UDFs or inserting into...
February 27, 2009 at 8:02 am
For finding the number of days in your select instead of a set value:
DELETE FROM Table WHERE Column < (GETDATE() - DAY(DATEADD (d, 1 - DAY(GETDATE()), GETDATE()) - 1))
June 13, 2008 at 8:11 am
Viewing 11 posts - 46 through 56 (of 56 total)