Viewing 15 posts - 7,861 through 7,875 (of 8,731 total)
You could use something like this.
DECLARE @median sysname,
@tablenm sysname
declare @sql nvarchar (max),
@med decimal(15,2)
set @sql = 'WITH MEDCTE (ID, MED)
AS (SELECT
Id,
AVG( ' + QUOTENAME(@median)...
July 24, 2013 at 2:36 pm
You don't need a cursor or a cycle. There's an easier, shorter and quicker way to do it.
You can read about it on this article. http://www.sqlservercentral.com/articles/comma+separated+list/71700/
SELECT CompanyCode,
Login = STUFF((
...
July 24, 2013 at 2:28 pm
You might have a character that might not be a space.
You can check which character is with this code (it's untested, but it should work).
WITH E1(N) AS (
...
July 24, 2013 at 2:21 pm
You could try something like this
DECLARE @cDate varchar(5) = '20114'
SELECT DATEADD( MONTH, RIGHT(@cDate, 1) , CAST( LEFT(@cDate,4) + '0101' as DATE))
July 23, 2013 at 9:43 pm
2011401 does not have a common format for a date. Can you explain which is the year, month and day?
July 23, 2013 at 6:11 pm
stillconfused (7/23/2013)
Hi,I found the below link which describes useful undocumented stored procedures. Does it mean to be good to use
EXECUTE xp_delete_file 0|1, 'file_name'
Which link?
As I said, there are some risks...
July 23, 2013 at 4:18 pm
You could use CTEs instead of the temporary tables. However, you should check for any possible performance issues.
WITH MOVEMENTS AS(
SELECT *
FROM [GW_DW].[dbo].[DimStatusHistory] d
WHERE TransferFromToProgram <> ''
AND d.STATUS = 12
),
NEW_MOVEMENTS...
July 23, 2013 at 4:09 pm
Check for something like this. If you have problems, it might be a permissions problem.
EXEC xp_cmdshell 'DEL "C:\My\Full\Path.bak" /Q';
GO
I wouldn't advice to use undocumented procedures on a production environment, but...
July 23, 2013 at 12:28 pm
You'll always be welcome here to learn as we all learn here.
The error you're getting is because the rollno on the order by is not qualified. Just add "s." before...
July 23, 2013 at 9:51 am
Sean Lange (7/23/2013)
I didn't just provide a solution because this looks so much like homework and the OP did not answer that one way or the other.
If this post was...
July 23, 2013 at 9:29 am
I didn't read the previous posts. The idea is really similar, but I'm not using a temp table (I probably should). This would be a lot easier on 2005+
SELECT s.*...
July 23, 2013 at 9:00 am
Scott,
I believe that Sue is mentioning the CTE that's included in the 8K Splitter that I mentioned.
July 22, 2013 at 3:25 pm
You don't need to cast it, an implicit conversion will transform strings into integers if the column only contains digits. If there's a non-integer value in your column, it will...
July 22, 2013 at 1:48 pm
Are you checking that the .bak file exists on the server and not on your desktop?
July 22, 2013 at 1:17 pm
Viewing 15 posts - 7,861 through 7,875 (of 8,731 total)