Viewing 15 posts - 5,791 through 5,805 (of 10,143 total)
dwain.c (8/29/2012)
ChrisM@Work (8/29/2012)
purushottam2 (8/29/2012)
I want to update in single query, other wise i have to use transaction and i can not use transaction.....
Why not? Seems very unreasonable.
You're using SQL Server...
August 29, 2012 at 4:10 am
purushottam2 (8/29/2012)
I want to update in single query, other wise i have to use transaction and i can not use transaction.....
Why not? Seems very unreasonable.
You're using SQL Server 2008 -...
August 29, 2012 at 3:56 am
The easiest way I could replicate this behaviour was by using the ANSI_DEFAULTS setting:
SET ANSI_DEFAULTS Off -- change to ON to raise error
DROP TABLE #SAP_CT_Codes
CREATE TABLE #SAP_CT_Codes (old_store_reference VARCHAR(8))
INSERT INTO...
August 29, 2012 at 3:51 am
hardus.lombaard (8/29/2012)
set a.Flag = 0
from table1 a
WHERE
a.OLD_NUMBER in (select number from table2) and
a.NEW_NUMBER not in (select number from table2)
The above query sets the flag column to 0...
August 29, 2012 at 2:49 am
dwain.c (8/28/2012)
CREATE TABLE...
August 29, 2012 at 2:10 am
amarkhowe (8/28/2012)
Brilliant thanksso this takes into in consideration if the name field is missing a title.
The expressions for title and forename will both generate a negative number for the length...
August 28, 2012 at 9:01 am
Thanks Andy, that will do fine. Incorporating into Anthony's dataset;
DECLARE @Account TABLE (AccountNo INT, Name VARCHAR(100))
INSERT INTO @Account VALUES
(60000000,'Mrs Rayford Hufflepuff18'),
(60000001,'Miss Forest Hufflepuff18'),
(60000061,'Miss Bex Ignore'),
(60000068,'Mr Jason Twirl'),
(60000088,'Mrs Katuta Sunger'),
(60000111,'Mrs Corene...
August 28, 2012 at 8:20 am
amarkhowe (8/28/2012)
sorry this is not working still its only applying it to some of the rows how do I create a ddl script to export the data?
Run the query I...
August 28, 2012 at 7:52 am
amarkhowe (8/28/2012)
Thanks for your help I have been able to get Chris's sql to work,Thanks for all your help.
Can you post the query, Andy? There are a couple of simple...
August 28, 2012 at 7:27 am
You can detect name strings with less than three words with a slight modification of the original query:
SELECT
AccountNo,
Name,
space1.pos,
space2.pos
--Title= LEFT(Name,space1.pos-1),
--Forename= SUBSTRING(Name,space1.pos+1,space2.pos-space1.pos-1),
--Surname= SUBSTRING(Name,space2.pos+1,8000)
FROM @Account
CROSS APPLY (SELECT CHARINDEX(' ', Name,1))...
August 28, 2012 at 7:06 am
amarkhowe (8/28/2012)
I'v attached an Excel file with test dataMany Thanks
Andy
Andy, if you set this up as a DDL script CREATE TABLE ... and INSERT INTO TABLE ..., then paste...
August 28, 2012 at 6:51 am
amarkhowe (8/28/2012)
AccountNumber,
Name,
Name = LEFT(Name,space1.pos-1),
Name = SUBSTRING(Name,space1.pos+1,space2.pos-space1.pos-1),
Name = SUBSTRING(Name,space2.pos+1,40)
FROM dbo.AccountBase
CROSS APPLY (SELECT CHARINDEX(' ', Name,1)) space1 (pos)
CROSS APPLY (SELECT CHARINDEX(' ', Name,space1.pos+1)) space2 (pos)
But the above creates an error
Msg 537,...
August 28, 2012 at 6:37 am
SELECT
CASE
WHEN (GROUPING([MAT]) = 1) THEN 'Tot'
ELSE [MAT] END
AS MAT,
--[myNUmber]
COUNT (*) AS [myNUmber]
FROM (
SELECT DISTINCT
CASE
WHEN LEFT (TZZ, 2) IN ('1D','1F') THEN 'MAO'
WHEN LEFT (TZZ, 2) IN ('1G','1H') THEN 'MAE'
WHEN...
August 28, 2012 at 6:34 am
amarkhowe (8/28/2012)
Full Name
MR Peter ASHWORTH
would end up as
Full Name TitleFirst...
August 28, 2012 at 6:25 am
amarkhowe (8/28/2012)
Thanks you for your reply!I do not want to drop the table but split the name on to the same table in new columns?
That's just sample data.
Change the...
August 28, 2012 at 6:03 am
Viewing 15 posts - 5,791 through 5,805 (of 10,143 total)