D
Drew
I have an access query for a report and I need to make it into a view for
SQL Server. Here is the Access query,
SELECT CliEventTable.RegNo, CliCoreTable.CliDOB, CliCoreTable.CliSex,
CliEventTable.EventDate, Format([EventDate],"w") AS [Day], "Qtr" &
Format([EventDate],"q"", ""yyyy") AS Quarter, CliEventTable.EventEvent,
CliEventTable.EventSubcategory, CliEventTable.EventLocation,
CliEventTable.EventIllnessInjury, CliEventTable.Mobility,
CliEventTable.FallPrecaution, CliEventTable.RepeatFaller
FROM CliEventTable INNER JOIN CliCoreTable ON CliEventTable.RegNo =
CliCoreTable.RegNo
WHERE (((CliEventTable.EventEvent)="Aggressive Act"));
This query uses the FORMAT command 2 times, one for finding the day of the
week, the other for making a string with the quarter. I have gotten
everything to work except building the quarter string. How can I make a
string in SQL Server. It needs to be like this, Qtr1, 2004. Here is my SQL
query,
SELECT dbo.Events.RegNo, CliCore.dbo.tblClients.CliDOB,
CliCore.dbo.tblClients.CliSex, dbo.Events.EventDate, dbo.Events.EventEvent,
DATEPART(dw, dbo.Events.EventDate) AS [Day], DATEPART(q,
dbo.Events.EventDate) AS Quarter, dbo.Events.EventSubcategory,
dbo.Events.EventLocation,
dbo.Events.EventIllnessInjury, dbo.Events.Mobility,
dbo.Events.FallPrecaution, dbo.Events.RepeatFaller
FROM dbo.Events INNER JOIN
CliCore.dbo.tblClients ON dbo.Events.RegNo =
CliCore.dbo.tblClients.RegNo
WHERE (dbo.Events.EventEvent = 2)
Thanks,
Drew Laing
SQL Server. Here is the Access query,
SELECT CliEventTable.RegNo, CliCoreTable.CliDOB, CliCoreTable.CliSex,
CliEventTable.EventDate, Format([EventDate],"w") AS [Day], "Qtr" &
Format([EventDate],"q"", ""yyyy") AS Quarter, CliEventTable.EventEvent,
CliEventTable.EventSubcategory, CliEventTable.EventLocation,
CliEventTable.EventIllnessInjury, CliEventTable.Mobility,
CliEventTable.FallPrecaution, CliEventTable.RepeatFaller
FROM CliEventTable INNER JOIN CliCoreTable ON CliEventTable.RegNo =
CliCoreTable.RegNo
WHERE (((CliEventTable.EventEvent)="Aggressive Act"));
This query uses the FORMAT command 2 times, one for finding the day of the
week, the other for making a string with the quarter. I have gotten
everything to work except building the quarter string. How can I make a
string in SQL Server. It needs to be like this, Qtr1, 2004. Here is my SQL
query,
SELECT dbo.Events.RegNo, CliCore.dbo.tblClients.CliDOB,
CliCore.dbo.tblClients.CliSex, dbo.Events.EventDate, dbo.Events.EventEvent,
DATEPART(dw, dbo.Events.EventDate) AS [Day], DATEPART(q,
dbo.Events.EventDate) AS Quarter, dbo.Events.EventSubcategory,
dbo.Events.EventLocation,
dbo.Events.EventIllnessInjury, dbo.Events.Mobility,
dbo.Events.FallPrecaution, dbo.Events.RepeatFaller
FROM dbo.Events INNER JOIN
CliCore.dbo.tblClients ON dbo.Events.RegNo =
CliCore.dbo.tblClients.RegNo
WHERE (dbo.Events.EventEvent = 2)
Thanks,
Drew Laing