Viewing 15 posts - 1,891 through 1,905 (of 10,144 total)
_watching (12/1/2015)
http://cc.davelozinski.com/sql/like-vs-substring-vs-leftright-vs-charindex
which shows the speed differences between LEFT, RIGHT, LIKE, SUBSTRING,...
December 1, 2015 at 2:30 am
This code sample might help too:
DECLARE
@data VARCHAR(20) = 'Cap',
@DataToReplace VARCHAR(100) = 'cp',
@ReplacedWithData VARCHAR(100) = 'xy'
;WITH Itally AS (SELECT * FROM (VALUES (1),(2),(3),(4),(5),(6),(7)) d (n))
SELECT @data = REPLACE(@Data,SUBSTRING(@DataToReplace,n,1),SUBSTRING(@ReplacedWithData,n,1))
FROM iTally
WHERE n <=...
November 30, 2015 at 8:22 am
jkramprakash (11/24/2015)
SELECT last_sign_in_at,
CAST(DATEDIFF(yy, last_sign_in_at, GETDATE()) AS NVARCHAR(4)) + ' years, ' +
CAST(DATEDIFF(m, last_sign_in_at, GETDATE()) AS...
November 25, 2015 at 8:08 am
PHXHoward (11/24/2015)
It would be useful for me to...
November 25, 2015 at 1:31 am
Scott-144766 (11/24/2015)
From Books Online (bold emphasis mine). Is this your problem?ASCII (Transact-SQL)
Returns the ASCII code value of the leftmost character of a character expression.
Not really, he was warned of this...
November 24, 2015 at 8:31 am
Minnu (11/24/2015)
hi Team,How to create a view with below logic,
-- want to delete from unify table before insert.
DELETE FROM dbo.Unify
GO
INSERT INTO dbo.unify (PS_code, PS_Name)
SELECT PS_code, PS_Name FROM [dbo].[Unify_HHT]
As others have...
November 24, 2015 at 6:58 am
PHXHoward (11/23/2015)
November 24, 2015 at 3:16 am
michal.lisinski (11/24/2015)
Please clarify, you want to return digits "1 year" or "one year"?
Beside of question above ,small example:
SELECT name,
CAST(DATEDIFF(yy, create_date, GETDATE()) AS NVARCHAR(4)) + ' years, ' ...
November 24, 2015 at 2:35 am
jkramprakash (11/24/2015)
User_Last_Login_Date
-------------------------
2015-10-01
2015-11-20
2014-01-12
So i want to calculate the date difference with today date in the form of years,...
November 24, 2015 at 2:19 am
Jason-299789 (11/19/2015)
Thank you for the feedback on the TOP 100 Percent, I do try and avoid it whenever possible, but I know ORDER BY is not allowed in CTE's without...
November 19, 2015 at 7:05 am
Lip turner (11/19/2015)
Can you just use like function?Select * from table
where description like 'des_kak%'
Always test:
DROP TABLE #SampleData
SELECT *
INTO #SampleData
FROM (VALUES
(1, 'Name_A', CAST('des_kakà' AS NVARCHAR(20))),
(2, 'Name_B', CAST('des_kaka'...
November 19, 2015 at 7:02 am
Shamelessly nicking Jeff's sample data:
--===== If it exists, drop the test table to make reruns easier in SSMS.
-- This is NOT a part of the solution.
IF OBJECT_ID('tempdb..#TestTable','U') IS NOT NULL...
November 19, 2015 at 5:41 am
Use UNICODE() instead of ASCII():
DECLARE @C NVARCHAR(10),@R NVARCHAR(10)
SELECT @C=N'12'
SELECT @R=N'12'
SELECT @C, UNICODE(@C), @R, UNICODE(@R)
-- don't forget that you are only comparing the first character of each string.
November 19, 2015 at 3:41 am
Is t1 a #temp table?
November 17, 2015 at 7:57 am
Brandie Tarvin (11/17/2015)
ChrisM@Work (11/17/2015)
Brandie Tarvin (11/16/2015)
Lynn Pettis (11/16/2015)
BlurBlur
Blur
The safety word is DBCC TIMEWARP(). @=)
Huh?
November 17, 2015 at 7:05 am
Viewing 15 posts - 1,891 through 1,905 (of 10,144 total)