Viewing 15 posts - 1,846 through 1,860 (of 2,007 total)
Lowell (7/14/2010)
the easiest way is to use a neat trick using FOR XML.
here's a nice example...
July 14, 2010 at 5:40 am
How about this?
--Start by making some test data
DECLARE @TABLE AS TABLE(
[RequestID] INT,
[ApprovalName] VARCHAR(35))
INSERT INTO @TABLE([RequestID],[ApprovalName])
SELECT 15, 'Manager'
UNION ALL SELECT 15, 'Director'
UNION ALL SELECT 16, 'Manager'
UNION ALL SELECT 16, 'Director'
UNION ALL...
July 14, 2010 at 5:37 am
Right, I cheated a bit 😛
--Test data
DECLARE @TABLE AS TABLE(
data CHAR(7))
INSERT INTO @TABLE
SELECT '1'
UNION ALL SELECT '1.1'
UNION ALL SELECT '1.1.3'
UNION ALL SELECT '1.2'
UNION ALL SELECT '1.2.1'
UNION ALL SELECT '1.2.2'
UNION ALL...
July 14, 2010 at 2:56 am
Chris Morris-439714 (7/13/2010)
Paul White NZ (7/13/2010)
Chris Morris-439714 (7/13/2010)
Paul White NZ (7/13/2010)
Where should 1.2.10 sort, I wonder...?Or 1.1.3, even...
Quite.
Sampathsoft, please can you confirm what position 1.1.3 would assume in your sequence?
Many...
July 13, 2010 at 6:27 am
Something like this?
DECLARE @thistime AS VARCHAR(10)
DECLARE @shift AS VARCHAR(10)
SET @thistime = CONVERT(VARCHAR(10), Getdate(), 108)
SELECT @thistime,
shift = CASE
...
July 13, 2010 at 6:24 am
Paul White NZ (7/13/2010)
Where should 1.2.10 sort, I wonder...?
You killed both solutions 😛
I'm thinking CHARINDEX, split on the period and sort that way?
Chris Morris-439714 (7/13/2010)
Or 1.1.3, even...
I think the OP...
July 13, 2010 at 6:15 am
Something like this?
--Test data
DECLARE @TABLE AS TABLE(
data CHAR(7))
INSERT INTO @TABLE
SELECT '1'
UNION ALL SELECT '1.1'
UNION ALL SELECT '1.1.3'
UNION ALL SELECT '1.2'
UNION ALL SELECT '1.2.1'
UNION ALL SELECT '1.2.2'
UNION ALL SELECT '1.2.3'
UNION ALL...
July 13, 2010 at 4:34 am
Jim McLeod (7/13/2010)
skcadavre, you've done almost exactly what mine did, but if the OP's code is part of a query, then a set-based solution (CASE) is necessary.
I'll be honest, I...
July 13, 2010 at 4:23 am
--Sample data creation
DECLARE @TABLE AS TABLE(
[ID] INT IDENTITY,
[Name] VARCHAR(50),
[A/C] MONEY)
INSERT INTO @TABLE ([Name],[A/C])
SELECT 'Cust 1', -£45
UNION ALL SELECT 'Cust 1', £80
UNION...
July 13, 2010 at 4:20 am
DECLARE @EXPECTEDDURATION INT
SET @EXPECTEDDURATION = 0
IF @EXPECTEDDURATION = 0
BEGIN
SELECT CONVERT(FLOAT, 1) / CONVERT(FLOAT, 1)
END
ELSE
SELECT CONVERT(FLOAT, 1) / CONVERT(FLOAT,...
July 13, 2010 at 3:58 am
You're missing an "END", which you would've been more likely to spot had you formatted your query as below 😉
ALTER PROCEDURE [dbo].[Sp_updateproduct]
-- Add the parameters for the stored procedure here...
July 13, 2010 at 3:14 am
http://www.sqlservercentral.com/scripts/T-SQL/69348/
--By Pradyothana Shastry, 2010/02/12
--Step 1: Setting NULLs and quoted identifiers to ON and checking the version of SQL Server
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE...
July 12, 2010 at 7:38 am
I don't want to sound rude, so don't take this the wrong way please 🙂
It sounds like you're parsing the query instead of executing.
Try pressing "F5" to execute, or go...
July 12, 2010 at 7:34 am
jcrawf02 (7/12/2010)
Lynn Pettis (7/7/2010)
Alvin Ramard (7/7/2010)
CirquedeSQLeil (7/7/2010)
Alvin Ramard (7/7/2010)
CirquedeSQLeil (7/7/2010)
Alvin Ramard (7/7/2010)
Jeff Moden (7/7/2010)
July 12, 2010 at 7:20 am
Should work. . .
What happens if you do
PRINT @@ServerName
?
Also, check
SELECT *
FROM MASTER..sysservers
July 12, 2010 at 7:16 am
Viewing 15 posts - 1,846 through 1,860 (of 2,007 total)