Skip to main content

Parse text field in sql server

Parsing TEXT field with Long String

ALTER PROCEDURE [dbo].[DrawMap_KMLImport]
@ProcedureID int,
@ProjectID int,
@Shape varchar(30) = null,
@ObjName varchar(100) = null,
@Notes varchar(1000) = null,
@Allcoords text = null,
@Fillcolor int = null,
@ForeColor int = null

AS
declare @selectByte int
declare @coords varchar(7600)
declare @startI int
set @selectByte = 7600
if @ProcedureID =0
begin


if right(@coords,1) <> ' '
set @coords = @coords + ' '
declare @libID integer
declare @objID varchar(40)
if @shape = 'point'
set @libID = 58
else if @shape = 'polyline'
set @libID = 32
else
set @libID = 30
set @objID = NEWID()
insert into drawmap_objects (ObjID, objName, ProjectID, libID, visible, fillcolor, forecolor)
values(@objID, @objName, @projectID, @libID, 1, @fillcolor, @forecolor)

declare @latlong varchar(30)
declare @long varchar(30)
declare @lat varchar(30)
declare @index int
declare @pointID varchar(40)
declare @i int
set @i = 0
set @startI = 1
while @startI + @selectByte - 1 <= datalength(@Allcoords) begin set @coords = substring(@Allcoords, @startI, @selectByte) WHILE CHARINDEX(',0 ',@coords) > 0
BEGIN
set @i = @i + 1
set @index = CHARINDEX(',0 ',@coords)
SELECT @latlong = ltrim(rtrim(SUBSTRING(@coords,1,@index -1)))
select @long = substring(@latlong, 1, CHARINDEX(',',@latlong)-1)
select @lat = substring(@latlong, CHARINDEX(',',@latlong)+1, datalength(@latlong))

set @pointID = NEWID()
insert into drawmap_point(pointID, objID, pointindex, lat, long)
values(@pointID, @objID, @i,@lat, @long)

SELECT @coords = SUBSTRING(@coords,@index+3,DATALENGTH(@coords))
END
set @startI = @startI + @selectByte
end
set @coords = @coords + substring(@Allcoords, @startI, datalength(@Allcoords) - (@starti) + 1)

WHILE CHARINDEX(',0 ',@coords) > 0
BEGIN
set @i = @i + 1
set @index = CHARINDEX(',0 ',@coords)
SELECT @latlong = ltrim(rtrim(SUBSTRING(@coords,1,@index -1)))
select @long = substring(@latlong, 1, CHARINDEX(',',@latlong)-1)
select @lat = substring(@latlong, CHARINDEX(',',@latlong)+1, datalength(@latlong))

set @pointID = NEWID()
insert into drawmap_point(pointID, objID, pointindex, lat, long)
values(@pointID, @objID, @i,@lat, @long)

SELECT @coords = SUBSTRING(@coords,@index+3,DATALENGTH(@coords))
END

return
end

Comments

Popular posts from this blog

user Emulator to debug Windows Mobile 6 in Vista

open Windows Mobile Device center Mobile Device Setting -> Connection Setting -> Allow connections to one of the following: Change to DMA in vs 2008, Go to Tools -> Device Emulator Manager select one from list, for example: windows mobile 6 professional emulator right on to cradle waiting for popup to establish the relationship (be sure get internet connection from Emulator)

android textsize sp, px, dp

android:textSize Since:  API Level Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp). Must be a dimension value, which is a floating point number appended with a unit such as " 14.5sp ". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). This may also be a reference to a resource (in the form " @[ package :] type : name ") or theme attribute (in the form " ?[ package :][ type :] name ") containing a value of this type. This corresponds to the global attribute resource symbol  textSize .

Request Signatures in Blackberry

Request Signatures in Blackberry need copy sigtool.db, sigtool.csk to SDK/component/Bin folder for example V 4.2.1 ../eclipse\plugins\net.rim.eide.componentpack4.2.1_4.2.1.17\components\bin