Viewing 15 posts - 286 through 300 (of 921 total)
Perhaps something like this?
CREATE PROC p_weeks @mo tinyint, @yr smallint AS
SET NOCOUNT ON
SELECT CONVERT(char(8),MIN(CAST(dt AS datetime)),1) + ' - ' + CONVERT(char(8),MAX(cast(dt AS datetime)),1)
FROM
(SELECT CAST(@yr AS...
December 31, 2003 at 7:51 am
SELECT o.Trck#, o.Pol#
FROM Chawra O JOIN
(SELECT Trck#
FROM
(SELECT DISTINCT Trck#, Pol#
FROM Chawra) c
GROUP BY Trck#
HAVING COUNT(*) > 1) x ON x.Trck# = o.Trck#
--Jonathan
December 30, 2003 at 2:21 pm
Why not just use CONVERT with Type 112 (ISO)?
SELECT CONVERT(char(8),GETDATE(),112)
--Jonathan
December 30, 2003 at 9:40 am
I know I've posted this before...
CREATE PROC p_NextID @SeqType char(2), @NextID int OUTPUT AS
SET NOCOUNT ON
UPDATE Sequences
SET @NextID = LastID = LastID...
December 30, 2003 at 9:16 am
Because, unlike the other string functions, they can return different results dependent upon the database compatibility level.
--Jonathan
December 30, 2003 at 7:34 am
USE Northwind
go
CREATE FUNCTION dbo.f_CheckPub(@pubid char(4))
RETURNS bit BEGIN
DECLARE @ret bit
IF EXISTS
(SELECT *
FROM pubs.dbo.Publishers
WHERE Pub_Id = @pubid) SET @ret = 1
ELSE SET @ret = 0
RETURN @ret...
December 29, 2003 at 5:05 pm
It was only in the last year that Microsoft grudgingly allowed this at all (I believe because they are now in the NAS software business and were asked by their...
December 29, 2003 at 9:41 am
SELECT MonthYr
FROM
(SELECT DISTINCT DATENAME(m,ProductionDate) + '-' + DATENAME(yy,ProductionDate) MonthYr, CONVERT(char(7),ProductionDate,120) MoYr
FROM MyTable) d
ORDER BY MoYr
--Jonathan
December 29, 2003 at 8:12 am
This could be the known problem where you need to put SET NOCOUNT ON in the stored procedure.
--Jonathan
December 29, 2003 at 6:43 am
You don't need a cursor to do this, of course. It's easy enough to do as just one update statement.
--Jonathan
December 29, 2003 at 6:40 am
quote:
Won't this work?Update Product
set P2.Account = Case when C2.Account is not null then C2.Account
else (select C1.Account from Product as P1...
December 29, 2003 at 6:32 am
Or, if you can stand yet another way:
CREATE FUNCTION dbo.f_ListTemp(@id int)
RETURNS varchar(8000) BEGIN
DECLARE @list varchar(8000)
SELECT @list = ISNULL(@list + ',','') + Name
FROM Temp
WHERE Id = @id
RETURN...
December 29, 2003 at 5:50 am
Assuming these columns are datetimes, you could convert using style 120. The real issue may be that you have insert processes that have a separate update statement following the...
December 26, 2003 at 5:40 am
If this is SQL Server 2000, you can use a UDF in a check constraint.
--Jonathan
December 26, 2003 at 5:26 am
quote:
Hi!I am trying to run a validation procedure on all articles for all published databases on the server. Because...
December 26, 2003 at 5:22 am
Viewing 15 posts - 286 through 300 (of 921 total)