Viewing 15 posts - 601 through 615 (of 2,007 total)
If for some reason you can't use a calendar table, you could do something like this: -
DECLARE @startDate DATE = '2012-07-05', @endDate DATE = '2012-07-26';
WITH t1(N) AS (SELECT N FROM...
July 4, 2012 at 2:04 am
See this article, which explains how to do it --> http://www.sqlservercentral.com/articles/Tally+Table/72993/%5B/url%5D.
June 28, 2012 at 2:43 am
Would this not achieve the same thing?
DECLARE @sql NVARCHAR(MAX), @SEARCH_STRING NVARCHAR(100) = '%TB_DIM%';
SELECT @sql = STUFF(sqlCode.value('.', 'varchar(max)'),1,10,'') + ';'
FROM (SELECT 'UNION ALL SELECT table_catalog + '+CHAR(39)+'.'+CHAR(39)+' + table_name ' +...
June 25, 2012 at 9:16 am
chaseurpuli (6/22/2012)
I want only the characters to th left of the first occurance of any list of...
June 22, 2012 at 10:41 am
Is this what you're looking for?
--Sample data
SELECT Name
INTO Employees
FROM (VALUES('edwardneuman!"<]'),
('mikemoreno)''>$:'),
...
June 22, 2012 at 1:27 am
imex (6/20/2012)
Try:
SELECT SUBSTRING(( SELECT ', ' + CAST(ID as varchar) + ' ' + Name
...
June 21, 2012 at 5:17 am
Check out Gail Shaw's blog post, she answers your question there --> http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/%5B/url%5D
June 21, 2012 at 3:55 am
BEGIN TRAN
--Build sample data in TEST table
SELECT col1
INTO TEST
FROM (VALUES('STYLE'),('HK82382'),('HK82386'),
('HK84174'),('HK86190'),('HK87143'),
...
June 20, 2012 at 10:27 am
Why are you trying to count without count?
Take this table:
SET NOCOUNT ON;
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
DROP TABLE #testEnvironment;
END;
SELECT TOP 1000000 IDENTITY(INT,1,1) AS ID,
REPLACE(CAST(NEWID() AS VARCHAR(36)),'-','...
June 20, 2012 at 6:27 am
Well, I doubt I'd be the developer I am today (or have the job I currently have) without Jeff and a lot of other people from this site (way too...
June 20, 2012 at 3:24 am
dwain.c (6/20/2012)
That's the same collation issue that I was trying to address the other day when timing REPLACE on another thread.
Just one question though. Did Jeff Moden...
June 20, 2012 at 3:10 am
Shall we take a look at performance?
SET NOCOUNT ON;
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
DROP TABLE #testEnvironment;
END;
SELECT TOP 1000000 IDENTITY(INT,1,1) AS ID,
REPLACE(CAST(NEWID() AS VARCHAR(36)),'-',' ') AS string
INTO...
June 20, 2012 at 2:41 am
A few ways. . . .
Since you haven't given us any sample data or DDL, these are untested and will have to be modified for your particular situation.
Dynamic SQL version...
June 19, 2012 at 8:50 am
dwain.c (6/19/2012)
Just guessing but the CHARINDEX approach is probably fastest (where's Cadavre when you need him :-P).
Careful what you ask for!
SET NOCOUNT ON;
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
...
June 19, 2012 at 5:56 am
I fail to see the point of this. Care to enlighten me? Why does it not matter which "emp_amount" is displayed? Data integrity is always important - I can't imagine...
June 18, 2012 at 9:03 am
Viewing 15 posts - 601 through 615 (of 2,007 total)