Viewing 15 posts - 196 through 210 (of 1,082 total)
make sure you understand the code incase the business rules change.
the last post of mine will always replace the 3rd last char...
May 13, 2009 at 5:02 am
try this one:
SELECT STUFF(@String,(LEN(@String)-2),1,'V')
Or
SELECT REVERSE(STUFF(REVERSE(@String),3,1,'V'))
May 13, 2009 at 4:58 am
here are all 3 example:
DECLARE @String VARCHAR(100)
SET @String = '234$123,N,N'
SELECT STUFF(@String,CHARINDEX('N',@String),1,'V') as [Replace 1st N]
SELECT STUFF(@String,9,1,'V') as [Replace 9th Char]
SELECT STUFF(@String,PATINDEX('%[A-Z]%',@String),1,'V') as [Replace 1st Alpa char]
May 13, 2009 at 4:55 am
is the query gonna always replace the first 'N' in your string with V or is your query gonna always replace the 9th position with V or will it always...
May 13, 2009 at 4:50 am
Hi Again,
Sorry I have been on holiday for the last 2 weeks 🙂
Do you still an explanation?
Thanks
Chris
May 12, 2009 at 2:32 am
Then I would says that what Lynn and I have posted with regards to the cross apply is what you looking for.
HOWEVER. because you going to be using multiline functions...
April 28, 2009 at 10:03 am
ok I see...
Would it be possible to see the function?
That way we can help you optimise the query.
April 28, 2009 at 9:56 am
sorry miss understanding.
When you say you can't get ride of the tvf! why is that?
I'm saying don't change or delete or alter the tvf. just leave it in the DB...
April 28, 2009 at 9:41 am
use the tally solution
April 28, 2009 at 9:36 am
try this
CREATE TABLE InputFields
(
InputFieldsID INT,
InputFieldName VARCHAR(100)
)
-----------------------------------
INSERT INTO InputFields
SELECT 1 ,'Name' UNION ALL
SELECT 2, 'Claim #' UNION ALL
SELECT 3, 'Email'
CREATE TABLE InputValues
(
InputValueID INT,
InputFieldsID INT,
InputFieldValue VARCHAR(100),
RowValue INT
)
---------------------------------------------------------------
INSERT INTO InputValues...
April 28, 2009 at 9:35 am
P.S if you wanted to use the function method then you would need something like a cross apply.
select *
from @tblDriver
CROSS APPLY dbo.tvfGetNumbers (StartNum)
However this would not be great code...
April 28, 2009 at 9:21 am
Would this work?
It requires a tally table but does not require a function
SELECT
RecNo,
StartNum + N -1
FROM @tblDriver, Tally
WHERE N < 4
April 28, 2009 at 9:17 am
I'm not sure how your data is in your table but I think this is what you looking for:
DECLARE @YourTable TABLE
(
ct_code INT,
type CHAR(1),
gm_id INT,
gl_id INT
)
INSERT INTO @YourTable
SELECT 201,'D', 1, NULL...
April 28, 2009 at 8:55 am
if it's null it's because there are no costs for that column.
You could use isnull around the cost values to so Zero or add a where clause to exlude rows...
April 28, 2009 at 8:22 am
Hi Jack,
Yeah concurrency is a problem with the solution provided.
The DBCC reseed to 0 then a reseed will always give you the next avaible seed value.
However I am with...
April 28, 2009 at 8:21 am
Viewing 15 posts - 196 through 210 (of 1,082 total)