Viewing 15 posts - 4,246 through 4,260 (of 8,731 total)
SQLPain (9/8/2015)
Would the following 2 statements fetch the same result?
1)AND (CC.EndDate >= H.SysDateTime OR (CC.EndDate IS NULL AND GETDATE() >= H.SysDateTime))
2)AND ISNULL(CC.EndDate, GETDATE())...
September 9, 2015 at 8:53 am
Sorry, I understood that you needed to print, copy and execute the code.
You can concatenate all the commands in a single string. This article explains how to do it: http://www.sqlservercentral.com/articles/comma+separated+list/71700/
DECLARE...
September 9, 2015 at 8:32 am
sgmunson (9/8/2015)
Luis Cazares (9/8/2015)
sgmunson (9/8/2015)
Based solely on the original post, only the GROUP BY portion of your query is actually needed:
It depends on the expected output. My code will return...
September 9, 2015 at 7:58 am
Don't you love the disappearing OPs?
September 9, 2015 at 7:53 am
Why don't you simply display the results as text instead of a grid?
September 9, 2015 at 7:50 am
SQLAddict01 (9/8/2015)
Select * from backups
where
databasename not in (select databasename from backups where servername...
September 9, 2015 at 7:41 am
You just accumulate the row counts. Be sure to initialize your variable to zero to avoid getting a null value.
while
process a chunk
set @p_affected_rows =...
September 9, 2015 at 7:35 am
Either you can write your query like this:
SELECT *
FROM Test
WHERE NOT( ServerName = 'D900'
AND DatabaseName = 'Test1')
Or you could tell us how do you define the first row. Remember...
September 8, 2015 at 1:56 pm
The subqueries make no sense as they're not tied to anything from the outside. You're probably after something simpler as this:
DECLARE @Start datetime,
@End datetime;
SELECT @Start =...
September 8, 2015 at 12:16 pm
This seems to return the same results as Jeff's code without the need of a tally table.
SELECT tt.*, new.String
FROM #MyHead tt
CROSS APPLY (SELECT SUBSTRING( pString, PATINDEX('%A[^BCD]%', pString), 8000)) Start(tString)
OUTER APPLY...
September 8, 2015 at 10:58 am
sgmunson (9/8/2015)
Based solely on the original post, only the GROUP BY portion of your query is actually needed:
It depends on the expected output. My code will return all the rows...
September 8, 2015 at 8:46 am
andreakreif (9/8/2015)
CREATE TABLE #SomeTable becomes ALTER TABLE #SomeTable.
Like Luis said, this is not an automated process.
Seems like regular expressions with patindex might work....
September 8, 2015 at 8:12 am
Jeff Moden (9/4/2015)
Luis Cazares (9/2/2015)
You also need to be sure about the server name you're using.
Nicely done, Luis.
Just a tip... if it all occurs on the server itself, you don't...
September 8, 2015 at 7:49 am
Want a cool Sig (9/4/2015)
DATEADD( YY, DATEDIFF(YY, 0, @Date),0)
Hi Luis, I've never seen this before and I don't see it in the online documentation... how does it work? I...
September 8, 2015 at 7:45 am
Reformatting full names is a pain and something you can't really automate in the real world without some problems. Take this example:
SELECT LEFT(FullName,CHARINDEX(' ',FullName)-1) AS x
,RIGHT(FullName,LEN(FullName)-CHARINDEX('...
September 8, 2015 at 6:29 am
Viewing 15 posts - 4,246 through 4,260 (of 8,731 total)