Viewing 15 posts - 1,636 through 1,650 (of 3,544 total)
p.s.
SELECT @result = COUNT(*)
FROM (SELECT c.[Date]
FROM @MyTable a
INNER JOIN [Calendar] c
ON c.[Date] >= a.StartDate AND c.[Date] <= a.EndDate
GROUP BY c.[Date]
HAVING COUNT(*) = 1) x...
Far away is close at hand in the images of elsewhere.
Anon.
March 7, 2007 at 7:17 am
Create a calendar table containing one [date] per day indexed on [Date]
Join this table to the one specified (where [date] between Start and End dates)
GROUP BY [date] HAVING COUNT(*) =...
Far away is close at hand in the images of elsewhere.
Anon.
March 7, 2007 at 7:13 am
The problem is the WHERE statement, it changes the LEFT JOIN to an INNER JOIN (there are several posts on this forum that details why)
Change the WHERE to an AND...
Far away is close at hand in the images of elsewhere.
Anon.
March 7, 2007 at 6:59 am
The result of the pivot without GROUPING will produce the following
| ID | Name | Address1 | Address2 | Address3 |
| 1 | Joe Smith | 400 Main St | ||
| 1 | Joe Smith | Apt 4 | ||
| 1 | Joe Smith | Anywhere, US 40404 | ||
| 2 | Bob Jones | 777 Maple Ln. | ||
| 2 | Bob Jones | Boston, MA ostalCode w:st="on">01201ostalCode> |
To reduce this to one line per ID we can GROUP on ID and Name but we require...
Far away is close at hand in the images of elsewhere.
Anon.
March 2, 2007 at 3:31 am
Or
SELECT coursegroup,COUNT(DISTINCT npp) AS [NoOfIPTS]
FROM dbo.Course
GROUP BY coursegroup
Far away is close at hand in the images of elsewhere.
Anon.
February 26, 2007 at 4:31 am
SELECT n.[ID],n.[Name],
MAX(CASE WHEN a.SeqNo = 1 THEN a.AddressField ELSE '' END) AS [Address1],
MAX(CASE WHEN a.SeqNo = 2 THEN a.AddressField ELSE '' END) AS [Address2],
MAX(CASE WHEN a.SeqNo =...
Far away is close at hand in the images of elsewhere.
Anon.
February 26, 2007 at 3:35 am
If the job step is type 'Transact-SQL Script (TSQL)', as in your case, and uses xp_cmdshell then the command will be run by SQL Server and SQL Server will need to...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 10:28 am
For the query in bcp, I do not know and cannot find any documentation that states a limit.
For EXEC the limit is the variable and therefore varchar(8000) for SQL2K. However...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 9:12 am
Only two things I can think of then
First, and most probable, your SQL Server is running under the 'Local System Account' instead of a Domain account. The Local System Account cannot...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 9:05 am
ah! ![]()
Just spotted something, you have a space in the output directory, you will need to put quotes around that as well
exec xp_cmdshell N'xcopy...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 7:31 am
Changing the database will make no difference if, as you should be, storing the dates as datetime.
The way the date is read dd/mm/yyyy or mm/dd/yyyy is dependant on the language...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 7:02 am
Try
declare @cmd varchar(4000), @sql varchar(100)
set @sql = 'select * from sysobjects'
set @cmd = 'master..xp_cmdshell ''bcp "' + @sql + '" queryout c:\test.csv -n -S (LOCAL) -e '''
exec...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 5:59 am
Doh!!
XCOPY errors are redirected to STDERR and wont appear in the job.txt file
Set the Job Step to log output and check the...
Far away is close at hand in the images of elsewhere.
Anon.
February 22, 2007 at 5:02 am
Probably access permissions, 2 thing to try
1. Change job step to log information to a file and check the file
2. change the command to
exec xp_cmdshell N'xcopy /Y "D:\Program Files\Microsoft SQL...
Far away is close at hand in the images of elsewhere.
Anon.
February 21, 2007 at 10:41 am
Viewing 15 posts - 1,636 through 1,650 (of 3,544 total)