Viewing 15 posts - 781 through 795 (of 2,006 total)
seth delconte (3/26/2012)
REPLACE works too 😀
SELECT id,Nivel,REPLACE(A,'0','')A,REPLACE(B,'0','')B...FROM @tblCron
I try to avoid implicit conversions where possible
March 26, 2012 at 10:12 am
Really? Did you actually try this on your own first?
SELECT id, Nivel,
CASE WHEN A = 0 THEN '' ELSE CAST(A AS CHAR(1)) END AS...
March 26, 2012 at 9:35 am
Well, on the rare occasions that I've been forced to do something like this I would generally use a CLR regex.
If you need a pure SQL solution, would something like...
March 26, 2012 at 4:50 am
Ah-ha!!
Told you it was my fault 😀
OK, I don't have my sandbox turned on at home, so can't give you tested code, but basically it's because we are selecting duplicates.
So,...
March 23, 2012 at 11:40 am
NuB2Sql (3/23/2012)
however, here are the errors i am getting when I try your code:
Msg 1056, Level 15, State 1, Line 2
The number...
March 23, 2012 at 10:17 am
Couple of ways: -
SELECT RelationshipID, ParentID, ChildID, RoleID, StatusID,
CreateDate, ActionID
FROM (SELECT a.RelationshipID, a.ParentID, a.ChildID, a.RoleID, a.StatusID,
a.CreateDate, a.ActionID,
ROW_NUMBER()...
March 23, 2012 at 9:36 am
NuB2Sql (3/23/2012)
Sorry about that!I have edited it as needed (hopefully)
and thanks for your help--very much appreciated.
No problem 🙂
OK, firstly I've fixed your create table statement and formatted the whole...
March 23, 2012 at 9:12 am
Hello and welcome to SSC!
I'd like to be able to help, but it seems you've forgot to post readily consumable sample data and ddl scripts.
March 23, 2012 at 8:25 am
Jeff's string splitter is the quickest non-CLR method.
Here's a way using XML: -
DECLARE @str AS NVARCHAR(max), @XMLList AS XML;
SET @str = 'Alter table dbo.TableA add test int';
SELECT @XMLList = CAST(REPLACE(REPLACE(REPLACE(
...
March 23, 2012 at 5:09 am
If this needs to be done in SSIS, I'm fairly sure that it has PIVOT/UNPIVOT operators in the data flow task.
March 23, 2012 at 2:29 am
--Your sample data
SELECT ChoiceId, ChoiceName, QuestionId
INTO yourTable
FROM (VALUES(101655,'3 Months',15418),(101656,'6 Months',15418),
(101657,'1 Year',15418),(101658,'Whenever Necessary',15418),
...
March 21, 2012 at 7:45 am
Lambert Antonio (3/21/2012)
thanks Cadavre
No problem.
In case you're interested, the cursor is also massively outperformed by my method as well.
See: -
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
DROP TABLE #testEnvironment;
END;
--1,000,000...
March 21, 2012 at 6:05 am
Here's one way: -
--Your sample data (Thanks, makes it much easier when readily consumable sample data exists)
DECLARE @t1 TABLE (refno VARCHAR(50));
INSERT INTO @t1
SELECT 'r1'
UNION SELECT 'r2'
UNION SELECT 'r3'
UNION SELECT 'r4'
UNION...
March 21, 2012 at 5:33 am
Here's one way: -
BEGIN TRAN
--Create sample data
CREATE TABLE yourTable (Transdate DATE);
INSERT INTO yourTable
SELECT Transdate
FROM (VALUES('2012-01-01'),('2012-01-07'),('2012-01-10'),('2012-01-12'),
('2012-01-18'),('2012-01-21'))a(Transdate);
...
March 21, 2012 at 3:49 am
All changes to SQL Server require in depth testing of every application before the change is made live.
Without testing you're guessing that it'll all work. That's not good...
March 20, 2012 at 4:37 am
Viewing 15 posts - 781 through 795 (of 2,006 total)