Viewing 15 posts - 7,426 through 7,440 (of 8,731 total)
As CONVERT won't give you the format you require, you need to play with the string returned.
SELECT REPLACE( RIGHT( CONVERT( varchar(9), GETDATE(), 6), 6), ' ', '-'),
STUFF(...
November 22, 2013 at 8:31 am
Why are you inserting into a table variable and then selecting from it instead of doing the select directly as you do with your original query?
Sean, I can't see why...
November 22, 2013 at 8:20 am
As it might get complicated for someone who is not related to all of the techniques mentioned, here's an example using a CTE for the sample data.
Check it and ask...
November 21, 2013 at 6:25 pm
Besides of the CROSS TABS, you should review the concept of a Tally Table and I believe you might want to check on creating character-separated lists to have just one...
November 21, 2013 at 6:13 pm
I would go for the CTE option since it doesn't require to copy the whole table just to filter the results instead of doing it in the same statement.
November 21, 2013 at 2:53 pm
This is basically the same that the previous update posted by Abu Dina.
UPDATE o SET
orderStatus = CASE WHEN s.orderQty = s.receivedQty THEN 'Complete'
WHEN s.orderQty > s.receivedQty AND s.receivedQty > 0...
November 21, 2013 at 8:42 am
Beware of ISNUMERIC(), you might have some problems if you don't consider all the possibilities.
http://www.sqlservercentral.com/articles/IsNumeric/71512/
If you're using SQL Server 2012 or 2014, go for TRY_PARSE,TRY_CONVERT or TRY_CAST.
November 21, 2013 at 8:30 am
Even if it's included in BOL, would people read the warnings?
Most people having bad coding habits won't even read basic documentation and go for what they suppose is better with...
November 21, 2013 at 8:26 am
You're right Scott. I'm not sure why did I have that in mind.
Silly me.:hehe:
November 20, 2013 at 2:20 pm
As Sean pointed out, this is a really bad idea. However, if you need help, please post DDL, sample data in the form of INSERT statements, expected results and what...
November 20, 2013 at 2:16 pm
Unfortunately, with approximate numerics you don't have many options. And here they are:
DECLARE @n float = -1.19056542300058E+15
SELECT @n float,
CONVERT( varchar(13), @n, 0 ) with_6_digits,
CONVERT( varchar(15), @n, 1 )...
November 20, 2013 at 2:11 pm
If it will grow everyday anyway, why would you want to shrink it? Do you dislike good performance?
As I understand, your log backup is not there for disaster recovery but...
November 20, 2013 at 2:03 pm
Here's an option. If your ID has gaps, you should create a virtual one using ROW_NUMBER()
SELECT t1.*
FROM @t t1
LEFT
JOIN @t t2 ON t1.ID = t2.ID + 1 AND t1.Value =...
November 20, 2013 at 11:29 am
You don't have to convert all of them explicitly using CAST or CONVERT unless you need a special format.
As all values will show in a single column, the first value...
November 20, 2013 at 10:57 am
You're looking for UNPIVOT or an alternate version using CROSS APPLY and VALUES[/url].
select x.*
from #Member
CROSS APPLY(VALUES('RowID', CAST( RowID AS varchar(100))),
('FirstName', FirstName),
('MiddleName', MiddleName),
('LastName', LastName),
('StreetAddress', StreetAddress),
('Suite', Suite),
('CityName', CityName),
('StateName', StateName),
('PostalCode',...
November 20, 2013 at 10:32 am
Viewing 15 posts - 7,426 through 7,440 (of 8,731 total)