473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Still need more help

I am having trouble working on a cursor function could someone check for me it the should work.

ALTER Function dbo.ZeroFill_ObjectNumber (@ObjectNumber char(42))
RETURNS Varchar(2000) AS

BEGIN

declare @stringvar as varchar(255)

declare cur CURSOR FOR select Objects.ObjectNumber
from Objects
where ObjectLevelID = '6'
and objectnumber like 'GR%'
and objectnumber not like 'GR[0-9][0-9][0-9][0-9]'
and objectnumber not like 'GR[0-9][0-9][0-9][0-9][.][0-9][0-9][0-9][0-9]%'
and objectnumber not like 'GR[0-9]'
--and Objects.ObjectId = ObjComponents.ObjectId
OPEN cur
set @stringvar = ''

fetch next from cur into @stringvar
While @@fetch_status = 0
BEGIN
IF @stringvar Like '%.[0-9][0-9]/%'
Begin

set @stringvar = substring(@stringvar,1,patindex('%.%',@stringvar)) + '00' +substring(@stringvar,patindex('%.%',@stringvar)+1 ,len(@stringvar))
End
Else If @stringvar Like '%.[0-9][0-9][0-9]/%'
Begin

set @stringvar = substring(@stringvar,1,patindex('%.%',@stringvar)) + '0' +substring(@stringvar,patindex('%.%',@stringvar)+1 ,len(@stringvar))
End
fetch next from cur into @Stringvar

END
CLOSE cur
DeAllocate cur

return @stringvar

END


as well I am have touble figuring out how to then set a update up to change the ObjectNumber in the objects table.

I hope you can help
Jul 31 '07 #1
0 736

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MARTIN DAVIES | last post by:
I hope you can help. My Linux MYSQL 3.23.52 database server is working OK generally. However, in a database I have a field name that ends with a # (hash UK as opposed to £ which is a pound UK)...
34
by: s c o t t | last post by:
I know Jakob Neilsen and a bunch of other usability advocates and critics usually frown on usage frames. However, most people probably seem to have at least version 5 of IE or newer and I am...
11
by: Jack | last post by:
I have a asp form where among others there are few text boxes and one check box. The checkbox is to indicate whether the entry is final. The checkbox is attahced to a field in table of type...
13
by: EggsAckley | last post by:
Hi: I have a file that I have been told is a SQL Server backup from a server somewhere. The file is about 200MB in size I am trying to create the database on my local server using RESTORE. I...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
46
by: Kamilche | last post by:
I switched to Python a couple years ago, and haven't looked back. I've used Python for many applications, including several commercial plugins for Poser. I don't post on here much, because I don't...
7
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work....
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
8
by: john | last post by:
To test a new piece of software designed to help with (among other things) eCommerce WWW site development. The software is fairly easy to use but you must fit a profile. Retail price is 120 GBP and...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.