Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Monday, March 26, 2012

Replace substring

Hello
Need to replace text_A with text_B contained within 2 columns of table., SQL
server 2000.
table name = stock
column names = description and long_description
Thanks for any help
Regards
Maxwellmaxbrit wrote:

> Need to replace text_A with text_B contained within 2 columns of
> table., SQL server 2000.
> table name = stock
> column names = description and long_description
update stock set description = replace(description, 'text_A',
'text_B'), long_description = replace(long_description, 'text_A',
'text_B'),
HTH,
Stijn Verrept.|||Many thanks for quick reply.
Merry Christmas and a Happy New Year.
"Stijn Verrept" <TURN_moc.tfosyrtne@.njits_AROUND> wrote in message
news:IdydnaFpC_7QajrenZ2dnUVZ8qWdnZ2d@.sc
arlet.biz...
> maxbrit wrote:
>
> update stock set description = replace(description, 'text_A',
> 'text_B'), long_description = replace(long_description, 'text_A',
> 'text_B'),
> --
> HTH,
> Stijn Verrept.

Wednesday, March 21, 2012

Replace Function? SQL2K/EM

Hi,
I need to change some table and field names - is there a way to update
all the occurances in Views and Stored procedures?Update the source code for the views and stored procedures and then redeploy
them. You can use the rows from sysdepends to determine which views and
stored procs are affected by name change of a table.
"hals_left" <cc900630@.ntu.ac.uk> wrote in message
news:1150108178.447216.308320@.f14g2000cwb.googlegroups.com...
> Hi,
> I need to change some table and field names - is there a way to update
> all the occurances in Views and Stored procedures?
>|||Do they have to be updated manually?
Visual Studio has tools to do this automatically, does EM have nothing
similar for its source code ?
Tim Dot NoSpam wrote:
> Update the source code for the views and stored procedures and then redepl
oy
> them. You can use the rows from sysdepends to determine which views and
> stored procs are affected by name change of a table.
> "hals_left" <cc900630@.ntu.ac.uk> wrote in message
> news:1150108178.447216.308320@.f14g2000cwb.googlegroups.com...|||> Visual Studio has tools to do this automatically, does EM have nothing
> similar for its source code ?
EM/SSMS will not automatically rename objects because there is nothing on
the server side that will track dependencies. However, this one of the many
new features included in the upcoming Visual Studio 2005 Team Edition for
Database Professionals.
See http://msdn.microsoft.com/vstudio/t...ro/default.aspx
Hope this helps.
Dan Guzman
SQL Server MVP
"hals_left" <cc900630@.ntu.ac.uk> wrote in message
news:1150110493.525079.29150@.i40g2000cwc.googlegroups.com...
> Do they have to be updated manually?
> Visual Studio has tools to do this automatically, does EM have nothing
> similar for its source code ?
> Tim Dot NoSpam wrote:
>

Monday, March 12, 2012

Repeater and Stored PRocedure

Q1 - I want to compare file names uploaded by users with the name of the file present in the database.
I have a repeated control that shows the data alongwith an array of <input type=file> that is created
dynamically when the data is displayed in the repeater control. (So there is an input tag within the
ItemTEmplate tag in the repeater)
Now I want to compare the names of the files uploaded by the user with the values as displayed in the
repeater. Is there a way I can do this? So I need to be able to get the data (for example Name) as
displayed in the repeater control into a variable like Dim strName As String. Something like:
Dim strName As String = (value from the repeater control)
Can I do this? How?

Q2 - I want to return a value from a stored procedure that will be stored in a variable in VB and will be
used for comparison. So, I want to return a 0 or 1 and then use .ReturnValue method to store this value.
The problem that I am facing is that I am using a cursor. And as soon as return is called in the SP it exits
the procedure and returns only one value (1 if found 0 otherwise) So it does not loop through the complete
cursor. What can I do to fix this?
CODE:

OPEN cur1
--print 'Cursor Open'
FETCH NEXT FROM cur1 INTO @.varFile, @.varFileEx, @.varFileSt

WHILE @.@.FETCH_STATUS = 0
BEGIN
IF (@.varFile = @.FileName AND @.varFileEx = @.FileExt)
BEGIN
set @.varReturn = 0
END
ELSE
BEGIN
set @.varReturn = 1
END
FETCH NEXT FROM cur_FileSystem INTO @.varFileName, @.varFileExt, @.varFileStatus
return (@.varReturn)
END
CLOSE cur_FileSystem
DEALLOCATE cur_FileSystem


Please help.
Thanks

Once you call Return, the stored procedure is exited. So your loop is never executed more than once. It is difficult to tell exactly what you are trying to do, but clearly what you are doing will not return a result of more than a single row.|||Any help with Q 1 ?