Viewing 15 posts - 706 through 720 (of 1,082 total)
Do you really mean 92 Fields? or do you mean Rows?
August 28, 2008 at 3:52 am
HI there,
Try this:
DECLARE @mytable TABLE
(date DATETIME,
Field1 VARCHAR(10),
Field2 VARCHAR(10),
Field3 VARCHAR(10),
Field4 VARCHAR(10),
Field5 VARCHAR(10),
Field6 VARCHAR(10))
INSERT INTO @mytable
SELECT '2008/08/28','jim','Dave','jim','jim','Dave','Dave' UNION
SELECT '2008/08/29','Dave','Jim','Jim','Jim','Dave','Dave'
SELECT *
FROM @mytable
UPDATE @mytable
SET
Field1 = CASE Field1 WHEN 'Jim' THEN 'Dave' WHEN...
August 28, 2008 at 3:30 am
So you want to assign and return the value?
Or do you simple want to assign and use it again to calculate other variables?
If so then simply doing this will take...
August 27, 2008 at 10:01 am
HI there,
Sorry about this, but I'm not 100% sure what you trying to do!
Could you give me an input output example so that I can try and help?
Thanks
Chris
August 27, 2008 at 9:31 am
ooops sorry got ahead of myself
August 27, 2008 at 6:43 am
I noticed that your two solutions don't work if there is a dupicate row, so I'm not sure if that situation will actually occur or not.
August 27, 2008 at 6:41 am
HI All,
Not all of the solutions seem to work.
I was going to do some performance testing and noticed that not all of them work.
Here is the code for all the...
August 27, 2008 at 6:34 am
Good call it would be great to know which is faster
August 27, 2008 at 6:18 am
Hi there here is a solution using the PIVOT function
-- no col1 col2 col3 col4 col5
-- 1 aaa bbb ccc null null
-- 2 vvv nnn null null null
/*
CREATE TABLE #tmpTest...
August 27, 2008 at 5:55 am
Hi there,
TRy creating a function that uses a Tally table.
Here is my solution:
CREATE FUNCTION [dbo].[Split]
(
@String NVARCHAR(100) ,
@Delimiter CHAR(1)
)
RETURNS @Results TABLE
(ID INT IDENTITY(1,1),
String VARCHAR(100))
AS
BEGIN
INSERT INTO @Results
SELECT SUBSTRING(@String+@Delimiter, n,
CHARINDEX(@Delimiter, @String+@Delimiter,...
August 27, 2008 at 5:32 am
TRy this.
UPDATE e
SET e.passportcode = p.passportcode
FROM Employee e
INNER JOIN Passport p ON p.EmployeeId = e.EmployeeId
August 27, 2008 at 3:08 am
Hi there,
Which version of SQL are you using as I see you have posted this on 2000 and 2005 forums
Please could you remove one of them?
Thanks
Chris
August 27, 2008 at 3:05 am
Is this homework?
If you let us know what you have tried so far then we can guide you in the correct direction 🙂
August 27, 2008 at 2:58 am
Viewing 15 posts - 706 through 720 (of 1,082 total)