Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script erro

Status
Not open for further replies.

camy123

Programmer
Mar 5, 2004
171
GB
guys ive written a script update row by rows on a table
but i get this error i know its something to do with replication but how do i resolve it.

Server: Msg 18750, Level 16, State 4, Procedure upd_F1E69E45D5304681833AD6E92EE73B6B, Line 51
INITCOLVS: The parameter 'nickname' is invalid.
 
i dont know ?? there is no param in my script called @nickname
 
-------------------------------------/* Create Tempory table */----------------------------------------------

--drop table #stack

Create table #stack
(
info1 varchar(786),
trowguid varchar(786)
)

go
-------------------------------------/* End Tempory table */----------------------------------------------



-------------------------------------/* Populate stack */----------------------------------------------


insert into #stack

select info1,rowguid from tablename
where col.tablename = 'C5BE365C-186D-11D5-B6F6-0002A52B4D33'
order by info1

go
-------------------------------------/* end population */----------------------------------------------



-------------------------------------initialise Variables----------------------------------------------

declare
@index int,
@maxindex int,
@Vinfo1 varchar(786),
@Vtrowguid varchar(786),
@len varchar(786),
@myvalue varchar(786),
@p1 varchar(5),
@p2 varchar(5),
@newstring varchar(50)

--Find rowcount for loop--
select @maxindex = count(*) from #stack
--End rowcount for loop--

set @index = 1

-------------------------------------END initialise Variables----------------------------------------------


-------------------------------------Start transformation-------------------------------------------------

while @index < @maxindex

begin
select top 1 @Vinfo1 = info1 from #stack
select top 1 @Vtrowguid = trowguid from #stack
GOTO check_for_Null
delete from #stack where trowguid = @Vtrowguid
end
--add code to delete to top layer of stack .. ---

--- HERE ----




check_for_Null:
if @vinfo1 is null
begin
set @vinfo1 = ''
goto Update_row
end
else
goto check_len




check_len:

set @len = len(@vinfo1)

if @len <= 3
begin
set @vinfo1 = ''
goto Update_row
end
else
goto check_substring




check_substring:
--check for len of first 2 letter/words and then check to see if it patindex "/"


select @myvalue = substring(@vinfo1,patindex('%/%',@vinfo1)-4,4)

set @len = len(@myvalue)


if @len=2
begin
goto transform_data
end

else if @len=4
begin
goto update_row
end

else if @len=0
begin
goto trashCan
end








transform_data:



set @vinfo1 = '04/2004'

select @p1 = substring(@vinfo1,patindex('%/%',@vinfo1)-4,4)


select @p2 = substring(@vinfo1,patindex('%/%',@vinfo1)+1,4)


set @newstring = @p2 + '/' + @p1
set @vinfo1 = @newstring
goto update_row
select @vinfo1



update_row:

update tablename set info1 = @vinfo1
where col.tablename = 'C5BE365C-186D-11D5-B6F6-0002A52B4D33' and
rowguid = @Vtrowguid


trashCan:
print ' trash can'
 
can you script your procedure upd_F1E69E45D5304681833AD6E92EE73B6B
and post the code so we can see it exectly as it is.

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
ok .. that procedure is not mine. . so i cant tinker with that i belive sqls server creates that prcedure when replication is created
 
ok sorry didnt know that - cant help you then.

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top