Viewing 15 posts - 766 through 780 (of 921 total)
SELECT DATEPART(dw,DateCol), SUM(AmtCol)
FROM TheTable
GROUP BY DATEPART(dw,DateCol)
You can use CASE() with DATEPART() in the select clause to show the day of week as its name.
--Jonathan
October 6, 2003 at 9:40 am
quote:
Thanks for the answers so far.vbCrLf is the VB constant for carriage return plus a line feed, so I guess I have...
October 6, 2003 at 9:18 am
WHILE @@ROWCOUNT > 0
BEGIN
UPDATE TheTable SET TextCol =
SUBSTRING(TextCol,1,PATINDEX('%<BR>%',TextCol) - 1) +'vbCrLf' +
SUBSTRING(TextCol,PATINDEX('%<BR>%',TextCol)+4, DATALENGTH(TextCol) - PATINDEX('%<BR>%',TextCol))
WHERE TextCol LIKE '%<BR>%'
END
--Jonathan
October 6, 2003 at 8:57 am
quote:
When you do transaction log backul on db with Bulk-Logged recovery model, the backup contanins:
1) Content of the transaction log which covers...
October 6, 2003 at 8:25 am
quote:
Jonathan's solution won't work if the minimum values of both columns are not in the same row. It will return unrelated data.A...
October 6, 2003 at 6:48 am
quote:
Hello Jonathan,
This is indeed a smart solution that u have provided. Just a query...how good a practice, is it to refer to...
October 6, 2003 at 6:39 am
If there will ever be an index on your date column, you're better off not using BETWEEN. As you've got the surrounding dates as just dates with no times,...
October 6, 2003 at 6:24 am
Use the results as a derived table and then just GROUP BY again.
SELECT Col1, MIN(Col2), MIN(Col3)
FROM Results
GROUP By Col1
--Jonathan
October 6, 2003 at 6:04 am
As long as none of the courses will ever extend more than 255 days, you could use SQL Server's built-in Numbers table:
SELECT c.vcCourseTitle, c.dtTripStart + v.Number DayOffered
FROM Courses c JOIN...
October 6, 2003 at 5:48 am
Here's how to use output parameters:
CREATE PROCEDURE dbo.getModuleTitle
@ModuleID int,
@ModuleTitle nvarchar(50) OUTPUT
AS
SET NOCOUNT ON
SELECT @ModuleTitle = ModuleTitle
FROM dbo.Modules
WHERE ModuleID = @ModuleID
go
CREATE PROC myUpdate
@ModuleID int
AS
SET...
October 6, 2003 at 5:24 am
If all values do not require converting, I suggest you use the UDF with a WHERE clause like this:
UPDATE MyTable
SET MyCharCol = dbo.udf_Proper(MyCharCol)
WHERE CAST(MyCharCol AS varbinary(8000))...
October 4, 2003 at 6:58 am
quote:
The @@ROWCOUNT suggestion did the trick!The NEW statement is:
DECLARE @SEQ int
IF @@ROWCOUNT <> 0
BEGIN
SELECT @SEQ = (SELECT SeqNbr FROM DELETED)
INSERT INTO tblActions(action_type,...
October 3, 2003 at 4:29 pm
quote:
I just think the logs aren't useless because when you do transaction log backup on db with Bulk-Logged recovery model, sql server...
October 3, 2003 at 4:16 pm
quote:
You are right. I should say script all objects from your original database and create them in SQL Server 7.0 database, BCP...
October 2, 2003 at 7:40 pm
quote:
Or the traditional way, BCP.
bcp is for copying data, it will...
October 2, 2003 at 7:21 pm
Viewing 15 posts - 766 through 780 (of 921 total)