How Can I Parse Text Held In MS SQL 2005 Text Field

Apr 24, 2007

Hi,
I been reading various web pages trying to figure out how I can extract some simple information from the XML below, but at present I cannot understand it.

I have a MS SQL 2005 database with which contains a field of type text (external database so field type cannot be changed to XML)
The text field in the database is similar to the one below but I have simplified it by remove many of the unneeded tags in the <before> and <after> blocks. I also reformatted it to show the structure (original had no spaces or returns)

For each text field in the SQL table contain the XML I need to know the OldVal and the NewVal.


<ProductMergeAudit>
 <before>
  <table name="table1" description="Test Desc">
   <product id="OldVal">
  </table>
 </before>
 <after>
  <table name="table1" description="Test Desc">
   <product id="NewVal">
  </table>
 </after>
</ProductMergeAudit>

View 2 Replies


ADVERTISEMENT

Parse XML Strings In SQL Text Field

Jul 23, 2005

I am trying to build a query on a SQL2000 text field which contains XMLstring. The query is like "select requestnumber from history whererequestnumber is like '%re1%'". As you can see in the following samplerecords, the xml string has database structure and the requestnumber isa node of the XML. I wonder if it is possible to have SQL server parsethis field and allow me to do the query. If not, any suggestion wouldbe appreciated as to how to store XML data in SQL2000. I am not sureif I misused the SQL2000 XML feature correctly. So far I pass the rawquery result to ADO and manipulate it in XMLDOM.The table is to capture history of changes in any record in mydatabase. So I need to keep it simple so any record from any table canbe stored in here. The structure of the table is like this:sysObjectNumber(int, not null)recordKeyValues(char(30), not null)archiveTime(datetime, not null)history(text, null)A sample record would be like the following:sysObjectNumber recordKeyValues arvhiveTime History=============== =============== =========== =======1728725211 ABC 2005-03-25 8:09:56.700<history><partnumber>ABC</partnumber><type>2140461537</type><color>1</color><remain></remain><lastdatein></lastdatein><lastdateout></lastdateout><lastquantityin></lastquantityin><lastquantityout></lastquantityout><threshhold>null</threshhold><usedby>user1</usedby></history>1728725211 ABC 2005-03-28 11:01:14.407<history><partnumber>ABC</partnumber><type>2140461537</type><color>1</color><remain></remain><lastdatein></lastdatein><lastdateout></lastdateout><lastquantityin></lastquantityin><lastquantityout></lastquantityout><threshhold>4</threshhold><usedby>user2</usedby></history>1728725211 ABC 2005-03-28 11:46:12.723<history><partnumber>ABC</partnumber><type>2140461537</type><color>1</color><remain>4</remain><lastdatein></lastdatein><lastdateout></lastdateout><lastquantityin></lastquantityin><lastquantityout></lastquantityout><threshhold>4</threshhold><usedby>user1</usedby></history>1728725211 ABC 2005-03-28 11:46:35.273<history><partnumber>ABC</partnumber><type>2140461537</type><color>1</color><remain>4</remain><lastdatein></lastdatein><lastdateout></lastdateout><lastquantityin></lastquantityin><lastquantityout></lastquantityout><threshhold>4</threshhold><usedby>user4</usedby></history>

View 1 Replies View Related

Problem With Text Field: Text Input Too Long, Weird Characters

May 15, 2006

Hi,

Im a programmer for an university webportal which uses php and msssql.
When an user creates a new entry and his text is too long the entry is cut short and weird characters appear at the end of the entry.

For example:
http://www.ttz.uni-magdeburg.de/scripts/test-messedb/php/index.php?option=show_presse&funktion=presse_show_mitteilung&id=333

How can I set the text limit to unlimited?
Could it be something else?
Is there a way of splitting an entry to several text fields automatically?


Thanks in advance for any help you can give me,
Chris

View 3 Replies View Related

SQL 2012 :: Text Qualifier Inside A Text Qualified Field

Mar 12, 2015

In SQL 2005 if i was trying to insert some data with a text qualifier inside a text qualified field, it would work, for example:

"Name","ID ","Location","","Comany",""House Name" Road",

In SQL 2012, this fails with the error message, cannot find the text qualifer for field.

To get around this, we are having to import the data into a Dirty Data column of aTEMP table, ID, Dirty Data, Clean data - perform multiple updates and change the text qualifier and ensure they are only changed in the right places so we can keep the ". In this example, we changed the text qualifier to PIPES.

After these updates, we then export the data from CLEAN data back out to CSV, then reimport it into the origional destination table with a new text qualifer.

View 5 Replies View Related

Transact SQL :: Server Text Field Not Returning Full Text

Apr 21, 2015

I have a column in a table that has a type TEXT,when I pull the length of a row it returns 88222 but when I select from that column it dows not show all the text in the result set.

View 3 Replies View Related

Using SQL Server (T-SQL) To Parse Text

Jul 23, 2005

In MS Access 2000 if I have a String such as:Column1Delta CC: 123Charley CC: 234Foxtrot CC: 890and I wanted to extact just the numbers in to a field called CCI could use this formula in a calculated field:CC: Mid([Column1],Instr(1,[Column1],"CC")+3,50)resulting in:CC123234890Any idea on what the code should be within a view in SQL Server?also -- what is a good reference that can help with these types ofproblems.Any help appreciated!RBollinger

View 2 Replies View Related

(Urgent) How Get A Text Field And Put The Result Into A Text Var

May 3, 2004

Hi All

Iam trying to Get a text field value i wrote this code

DECLARE @ptrval varbinary(16)
DECLARE @length bigint
SELECT @ptrval = TEXTPTR(Template), @length = LEN(Template)
FROM #TEMPLATE
READTEXT Template.#TEMPLATE @ptrval 0 @length

but i need to put the result into a text var
is that possible or not and if it possible any one could help me with that

View 1 Replies View Related

Adding Text To A TEXT Field (MS-SQL2000)

May 9, 2007

Hi everyone,

I'm extremely new to SQL so be nice

I am attempting to write a script to add onto the end of a text field the words " -- Disposed " (About 60 rows worth).
The field is a TEXT field, so unlike a varchar field I can't just use Update as shown below.


Code:

Update AR_Primary_asset
Set AR_Primary_asset.description = AR_Primary_asset.description + ' -- Disposed'
Where AR_Primary_Asset.ASSET_REF in ('1','2','4')



I found on the Mircosoft pages about UPDATETEXT, but this only seem to work to update one row (In the case below Asset_ref = 3, was the only row effected) .


Code:

DECLARE @Dispose binary(16)
SELECT @Dispose = TEXTPTR(DESCRIPTION)
FROM AR_PRIMARY_ASSET
WHERE AR_Primary_Asset.ASSET_REF in ('1','2','3')

UPDATETEXT AR_PRIMARY_ASSET.DESCRIPTION @ptrval null null ' -- Disposed'



So i wrapped it into a cursor, this worked on my test SQL server which runs SQL2005.


Code:

DECLARE @Dispose varbinary(16)

DECLARE cursor1 CURSOR FOR
SELECT TEXTPTR(DESCRIPTION)
FROM AR_Primary_Asset
Where AR_Primary_Asset.ASSET_REF in('1','2','3')

OPEN cursor1

FETCH NEXT FROM cursor1
INTO @Dispose

WHILE @@FETCH_STATUS = 0
BEGIN

UPDATETEXT AR_Primary_Asset.DESCRIPTION @Dispose NULL NULL ' -- Disposed'

FETCH NEXT FROM cursor1
INTO @Dispose
END

CLOSE cursor1
DEALLOCATE cursor1



But when it was run on our SQL2000 server it gave the following error message

Quote: Msg 403, Level 16, State 1, Line 1

Invalid operator for data type. Operator equals add, type equals text.

I've never used vars, cursors, updatetext or even text fields before. So maybe I am going about it totally the wrong way.

Is anyone able to tell me a better way to write this? or how to make it compatible to SQL2000?

View 4 Replies View Related

T-SQL (SS2K8) :: Insert Text In A Text Field

Jul 12, 2014

CREATE TABLE [dbo].[instructions](
[site_no] [int] NOT NULL,
[instructions] [text] NULL
)
Select top 3 * from instructions

Output

Site_noInstructions
20Request PIN then proceed
21Request PIN if wrong request name
22Request PIN allowed to use only numbers

All text instructions start with “Request PIN” but after that the text are different for every site_no

I need insert in all site_no rows and after the “Request PIN” the text “and codeword” keeping the current rest of text

Desired output

Site_noInstructions
20Request PIN and codeword then proceed
21Request PIN and codeword if wrong request name
22Request PIN and codeword allowed to use only numbers

View 3 Replies View Related

SQL 2012 :: Parse Data Separated Through Text

Nov 10, 2014

I am trying to parse data separated through text (ie abc1, abc2, abc3, abc4, etc).

ID ParseData
1 [abc1.Pants/abc2.Orange hat /abc3.Purple shirt /abc4./abc5./abc6./abc7./abc8.]
2 [abc1.Gray Shoes/abc2.Striped jacket /abc3./abc4./abc5./abc6./abc7./abc8.]
3 [abc1.Blue jeans/abc2./abc3./abc4./abc5./abc6./abc7./abc8.]

New Data (abc1, abc2, abc3, etc each have a field in the new data set)
ID ParseData abc1 abc2 abc3 abc4 abc5 abc6 abc7 abc8
1 [abc1.Pants...abc8.] Pants Orange hat Purple shirt
2 [abc1.Gray...abc8.] Gray Shoes Striped jacket
3 [abc1.Blue...abc8.] Blue Jeans

If I only want the data in between abc1 and abc2, between abc2 and abc3, etc, what would be the best way to do that?

My code so far looks like:
DECLARE
@string varchar(100) = '[abc1.Pants/abc2.Orange hat /abc3.Purple shirt /abc4./abc5./abc6./abc7./abc8.]',
@searchString1 varchar(20) = 'abc1',
@searchString2 varchar(20) = 'abc2';

SELECT newstring
FROM dbo.SubstringBetween(@string,@searchString1,@searchString2);

This returns 'Pants.'How do I continue to parse between abc2 and abc3? between abc3 and abc4?And then continue to ID2?Should I be referencing the ParseData field instead of string of data that I want to parse?

View 1 Replies View Related

Can SSIS Parse This Text Report Without A Lot Of Programming?

May 18, 2006

I've got some machines that output text files after each shot of parts. I'd like to take the data in those files and parse it and insert it into a SQL Server database for future massaging. The text files look like the example I've posted below. Can SSIS parse out the set points and actual values even though the file isn't CSV or tab delimited and the data is kind of 'strewn' all over the report? Each report does have the exact same format so the report format doesn't change from report to report, just the data. Thanks in advance.

Ernie



WP4.57 C Y C L E P R O T O C O L





Order data 18.05.06 11:27:57



Order number : 2006 Recipe no. : 15761

Machine number : 7 Recipe name : Stabilizer Bar Innsulator

Machine Operator: 1257 Art.descrip.: Stabilizer Bar Grommet

Shot Volume : 285.8

Part quantity : 100096 Type of mat.: M370-34

Shot quantity : 782 Batch number: 20124-125

-------------------------------------------------------------------------------

Temperatures in øC

Set Act Set Act

Fixed heat.platen right 182 182 Tempering screw 83 83

middle 180 180 Tempering inject.cylinder 85 85

left 182 182 Tempering circuit 3 90 91

Tempering circuit 4 0 39

Movab.heat.platen right 182 182 Tempering circuit 5 0 39

middle 180 180

left 182 182 Mould temperature 1 0 39

Mould temperature 2 0 39

Third heat.platen right 0 39 Mould temperature 3 0 39

middle 0 39 Mould temperature 4 0 39

left 0 39 Mould temperature 5 0 39



Mould heating circuit 6 0 39 Compound temp.after screw 104 104

Mould heating circuit 7 0 39 Compound temp.after nozzle 0 39

Mould heating circuit 8 0 39

Mould heating circuit 9 0 39

Mould heating circuit 10 0 39

---------------------------------------------------------------------------

Times in sec



Injection time 51.20 Transfer time 1 2.00

Internal mould press.time 0.00 Transfer time 2 2.00

Dwell pressure time 7.00 Transfer time 3 2.00

Controlled cure time 180.00 Transfer time 4 2.00

Calculated cure time 0.00 Transfer time 5 2.00

last cycle time 276

last opening time 25

---------------------------------------------------------------------------

Measure when injecting Measure at injection end



max. injection speed mm/s 11.9 Injection length mm 2.0

Injection energy kNm 247.2 Injection time sec 51.20

max. int.mould pres. bar 2 Hydraulic pressure bar 190

max. dwell pressure bar 192 Internal mould pressure bar 0

Pad mm 0.4

---------------------------------------------------------------------------

Stock Temperatures and Pressures During Metering



Stock Temperatures(C) Set Actual Metering Pressures(bar) Set Actual

Temperature 1st Step 105 106 Pressure 1st Step 135 131

Temperature 2nd Step 105 106 Pressure 2nd Step 135 129

Temperature 3rd Step 105 105 Pressure 3rd Step 135 122

Temperature 4th Step 105 106 Pressure 4th Step 135 135

Temperature 5th Step 105 109 Pressure 5th Step 135 137

Protocol Complete

View 1 Replies View Related

Can You Parse Out A Text String &> 8000 Chars Long??

Mar 30, 2005

Any way to parse out a text value (not varChar, using text data type) that is > than 8000 characters long? I'm looping through 1 big string passed to the DB that is pipe delimited, but I find myself needing the substring function to keep track of which segment I'm acting on (after an update, I then need to take that segment and remove it from the string)...but the subString function won't take anything larger than 8000 chars.

Say I have this string that is text data type...

'aaa|bbb|ccc|ddd|....'

..and so on, surpassing 8000 char length, how could you parse it out using the pipes as the delimter, then do an Update using that segment? Afterward, return to that string and find the next segment, then use it, and so on (in a loop). I tried using an update to set the string = replace(string, segmentJustUsed, '') to "erase" it, but replace can't take text as the datatype. Any help? Hope this isn't to confusing.

View 3 Replies View Related

Parse Text File (csv, Fix Width), Perl Or Something Newer?

May 26, 2007

I need to parse some text files and load them to database - these files are mostly CSV files or fix width columns format and the column names (first line) may vary in text (e.g. different abbreviation), order and extra columns, etc.

Is it a good idea have this done using script task of SSIS? How it compare to Perl on performance? Or any other tools good for this?

View 7 Replies View Related

Reporting Services :: How To Determine And Parse Out Text Using VBA In A SSRS Expression

Jun 1, 2015

I have a data field in a SSRS Report that contains the requestor's User Id. Their ID is prefixed with "PRIV"...And I'm assuming that is the direct result of the network domain. I need to create a SSRS expression to determine if the User ID is prefixed with "PRIV" and then parse that out and use what's behind the "" as their true User Id.

example...."PRIVID123456" should appear as "ID123456" in the report data line.

View 5 Replies View Related

Displaying Html Formatted Text In Text Object In Visual Studio 2005 Crystal Report

Apr 29, 2008

Hello,

I know this question has been asked here before, but it was ridiculously answered : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=98764&SiteID=1

I have a text object on my crystal report, to which I programmatically want to assign text in CS. It all works fine, except that if I have html tags in there, the text doesn't get formatted, it just displays the html tags as text as well.

Now in thread linked above, the answer was: right click the text object, and format the text object, hit paragraph text and select text interpretation to HTML. The only problem is, that for a text object, it doesn't have the text interpretation option. It's only an option for a formula field. It says so in the tech support link posted inside the post itself!!!

So if you have any idea how I can do this, please someone help me out. I am new to crystal, and there's not much helpful info on it online. I've searched for this for hours, and no solution.

Thanks

View 3 Replies View Related

What Is The 'Data Type' For A Field Containing Both Text And Number, In VS Studio 2005, Databases?

Dec 1, 2007

For a field in a database to accept both text and number what 'Data Type' should I be using, i.e. 23t5

View 1 Replies View Related

UNION - Errror &"Unable To Parse Query Text.&"

Feb 26, 2008

SELECT SID, SAmAccountName, DOMAIN, EmployeeID, CustAtr, DisplayName, UPN, Date, flag, Date_Mod, Date_Exp, IsActive, OU, Description, IDType
FROM dbo.CORP_EMP_IDS as corp_emp_ids
WHERE (EmployeeID BETWEEN 'A' AND 'Z') AND (IsActive = 1) AND (EmployeeID NOT IN ('gen', 'G', 'M', 'S', 'T', 'TT', 'AdminAcct', 'TestAcct', 'ConfRoom', 'AcctAdmin')) AND (Date_Exp > GETDATE() OR
Date_Exp = '') AND (SAmAccountName NOT LIKE '%$%')

UNION

SELECT SID, SAmAccountName, DOMAIN, EmployeeID, CustAtr, DisplayName, UPN, Date, flag, Date_Mod, Date_Exp, IsActive, OU, Description, IDType
FROM dbo.CORP_EMP_IDS AS CORP_EMP_IDS_1
WHERE (CustAtr BETWEEN 'A' AND 'Z') AND (IsActive = 1) AND (CustAtr NOT IN ('gen', 'G', 'M', 'S', 'T', 'TT', 'AdminAcct', 'TestAcct', 'ConfRoom', 'AcctAdmin','AdminAccts')) AND (Date_Exp > GETDATE() OR
Date_Exp = '') AND (SAmAccountName NOT LIKE '%$%')

ORDER BY EmployeeID

View 11 Replies View Related

Transact SQL :: Return Field When A Field Contains Text From Another Field

Aug 25, 2015

I'm new to SQL and I'm trying to write a statement to satisfy the following:

If [Field1] contains text from [Field2] then return [Field3] as [Field4].

I had two tables where there were no matching keys. I did a cross apply and am now trying to parse out the description to build the key.

View 8 Replies View Related

Access Memo Field To SQL Server Text Field

Nov 19, 2006

Hi,

I'm importing an Access database to SQL Server 2000.
The issue I ran into is pretty frustrating... All Memo fields that get copied over (as Text fields) appear to be fine and visible in SQL Server Enterprise Manager... except when I display them on the web via ASP - everything is blank (no content at all).

I didn't have that problem with Access, so I ruled out the possibility that there's something wrong with the original data.

Is this some sort of an encoding problem that arose during database import?
I would appreciate any pointers.

View 14 Replies View Related

Create Date Field From Substring Of Text Field

Jul 20, 2005

I am trying to populate a field in a SQL table based on the valuesreturned from using substring on a text field.Example:Field Name = RecNumField Value = 024071023The 7th and 8th character of this number is the year. I am able toget those digits by saying substring(recnum,7,2) and I get '02'. Nowwhat I need to do is determine if this is >= 50 then concatenate a'19' to the front of it or if it is less that '50' concatenate a '20'.This particular example should return '2002'. Then I want to take theresult of this and populate a field called TaxYear.Any help would be greatly apprecaietd.Mark

View 2 Replies View Related

MS Access Memo Field To SQL Server Text Field

Aug 20, 2006

Hi all,



i've a reasonable amount of experience with MS Access and less
experience with SQL Server. I've just written an .NET application that
uses an SQL Server database. I need to collate lots of data from around
the company in the simplest way, that can then be loaded into the SQL
Server database.



I decided to collect the info in Excel because that's what most people
know best and is the quickest to use. The idea being i could just copy
and paste the records directly into the SQL Server database table (in
the same format) using the SQL Server Management Studio, for
example.



Trouble is, i have a problem with line feed characters. If an Excel
cell contains a chunk of text with line breaks (Chr(10) or Chr(13))
then the copy'n'paste doesn't work - only the text up to the first line
break is pasted into the SQL Server database cell. The rest is not
pasted for some reason.



I've tried with MS Access too, copying and pasting the contents of a
memo field into SQL Server database, but with exactly the same problem.
I've tried with 'text' or 'varchar' SQL Server database field formats.



Since i've no experience of using different types of databases
interacting together, can someone suggest the simplest way of
transferring the data without getting this problem with the line feeds?
I don't want to spend hours writing scripts/programs when it's just
this linefeed problem that is preventing the whole lot just being
cut'n'pasted in 5 seconds!



cheers

Dominic

View 6 Replies View Related

Export Access Memo Field To SQL Text Field

May 30, 2006

Hi,

Can anyone point me any solution how to export a MEMO field from an Access database to a TEXT field from an MS SQL Server 2000. The import export tool from SQL server doesn't import these fields if they are very large - around 9000 characters.

Thanks.

View 1 Replies View Related

Compare Date Field To Text Field

Mar 27, 2008

Hi,

I am very new to using SQL. Our department usually uses Brio to query the various databases under our control. However, I have recently come against a problem that prompted me to create a custom SQL query which works well as far as it goes. My problem is looking for specific conditions in billing information I receive monthly. I would like to compare on of the date fields contained in the database with a field in the form of YYYYMM (200710, for October 2007) I have created a custom column generator that forms a date from the YYYYMM. I would like, however, do the translation on the fly and make the comparison during the query. The problem is that query without the date check returns a mass of data, only about 1 percent of which is what I want.

The beginning of the SQL query looks like this:

FROM From.T_Crs_Tran_Dtl WHERE T_Crs_Tran_Dtl.Crs_Bill_Yr_Mo IN ('200710', '200711', '200712') AND ((T_Crs_Tran_Dtl.Crs_Cde IN ('1G', '1V') AND (T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND (T_Crs_Tran_Dtl.Prev_Stats_Cde IN (' ', 'TK', 'TL') AND T_Crs_Tran_Dtl.Cur_Stats_Cde IN ('TK', 'TL') AND T_Crs_Tran_Dtl.Std_Tran_Typ_Cde='B') OR (T_Crs_Tran_Dtl.Prev_Stats_Cde='UN' AND T_Crs_Tran_Dtl.Cur_Stats_Cde='XX' AND

It is the (T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND? part of the query that is just plain wrong. The business part of this statement takes the YYYYMM field and turns it into a date which is the last day of YYYYMM.

I hope someone out there can help me with making this comparison.

I appreciate your help.

Bill

View 8 Replies View Related

Should I Use Text Field Or Binary Field ?

Jun 1, 2008

Application is ocr'ing tiff image files and then storing the resultant text data in a text field in SQL 2005 database. This field is then used with the full text catalog.

All works fine,

However, am I using the correct field type to store the text files for efficiency and space saving?

If I use a binary field, does this reduce the size of the database by compressing the text data in the binary field? Also, is there a limit as to the size of text file that I could store in a binary field?

It would be good to get feedback on this before I go too far down the wrong road.

So, text field to store the text data or binary field to store the actual text file?

View 12 Replies View Related

Searching Text In A Db Field

Sep 10, 2006

Im building up a query in my code behind. When I execute this query it returns a list of users who match the criteria.BUT, I want to add something extra. In my DB in the tblUserData there's a field "interests" datatype nvarchar(30) which contains the numbers (comma-delimited) of the interestsID in my tblInterests. For example, my interestsfield may contain something like: 1,4,8Now if someone wants to find someone who has number 4 and 8 as interests, how can I search in this textfield?!?I wrote this in a SP, but I'd really like it to be possible from code-behind and build the query myself...declare @s varchar(20)set @s='4,8'EXEC('SELECT * FROM tblUserData WHERE Interests in ('+@s+')')

View 1 Replies View Related

Long Text Field

Jun 6, 2008

 Hi

I
have a textbox field that take 2000 characters from user..Then I used a store
procedure to save that user input into database through an insert statement, but
for some reason it just never store the whole string of 2000 characters but only
store some of it (like 100 or something) .. Seems like a data type problem…(I  am using SQL server 2000)

 

This
is what I have defined:

 

---------------------------------------

In
storeprocedure:

 

@iidea2
varchar(2000)



 

View 3 Replies View Related

Problem With Text Field

Jul 3, 2004

Hi,

I am haveing a field called as description in a table called info in the database. Now when I give the following query:

select * from info where description = 'test'

it gives me error:

Microsoft OLE DB Provider for SQL Server (0x80040E14)
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

How can I do the above.

Thanks in advance,
Uday.

View 2 Replies View Related

Cant Sort A Text Field!

Mar 27, 2006

Hiive got a table and contains a surname text field.  Why cant i do a select statement ORDER BY surname.  I get an error saying i cant sort a text field!  how do i go around it!thanks

View 2 Replies View Related

Insert Text Field

Apr 3, 2001

Hellow, Everyone,

I am having a problem in Inserting a text field into another Text field on another table. each record in the field might be more than 255 charactors.

Any help would be appreciated.

Thanks,

View 1 Replies View Related

Splitting A Text Field

Feb 1, 2001

hi,
I am trying to split a text field .
what I want to do is -
split a text field and insert chars 1 to 8 in one field and then from 9 to 20 in another and so on.
Can someone help me in solving this.
TIA.
PD

View 3 Replies View Related

Updating A Text Field

Apr 27, 2000

I try to update a field of text datatype using WRITETEXT statement. The information that I try to change has both the single(') and double (") quotes in it.
How can I get it done ?

Thanks
Pete

View 1 Replies View Related

How To Update Text Field

Sep 8, 2004

Hi all,

I have a table with millions of records, table has three fields: case_id,line_no and notedata field, notedata field is 60 chars long, datatype varchar.for each case_id there could be as many as 2000 line_no meaning 2000 notes. I need to compress these notes into one note by case_no, For example case_no 1 could have 2000 lines of notes but my comressed table shoul have only one line containing all 2000 notes in line_no sequence.

my compressed table contains two fields case_no and notetext, notetext is a text field.

here is the script I am trying to use to accomplish the task but it does not append more than 8000 chars in one case, so my notes are chopping of, how should I do this, please let me know of any suggestions..

Thanks.



truncate table eldoecinotescompressed
insert into eldoecinotescompressed (app_code, case_no)
select distinct app_code, substring(system_key, 6,8)
from eldoecinotes

DECLARE @case VARCHAR(20);
DECLARE @note VARCHAR(80);
DECLARE @lineno VARCHAR(5);

DECLARE notes_cursor CURSOR FOR
select substring(system_key, 6,8) case_no, line_no, rtrim(notedata) notedata FROM EldoECINotes
where substring(system_key, 6,8)<>''
order by 1,2;
OPEN notes_cursor;
FETCH NEXT FROM notes_cursor into @case, @lineno, @note;
WHILE (@@FETCH_STATUS = 0)
BEGIN

BEGIN TRANSACTION;
update eldoecinotescompressed
set notetext =
(case when isnull(datalength(notetext), 0) >= 0 then
substring(isnull(notetext,''), 1, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 8000 then
substring(isnull(notetext,''), 8001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 16000 then
substring(isnull(notetext,''), 16001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 24000 then
substring(isnull(notetext,''), 24001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 32000 then
substring(isnull(notetext,''), 32001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 40000 then
substring(isnull(notetext,''), 40001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 48000 then
substring(isnull(notetext,''), 48001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 56000 then
substring(isnull(notetext,''), 56001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 64000 then
substring(isnull(notetext,''), 64001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 72000 then
substring(isnull(notetext,''), 72001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 80000 then
substring(isnull(notetext,''), 80001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 88000 then
substring(isnull(notetext,''), 88001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 96000 then
substring(isnull(notetext,''), 96001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 104000 then
substring(isnull(notetext,''), 104001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 112000 then
substring(isnull(notetext,''), 112001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 120000 then
substring(isnull(notetext,''), 120001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 128000 then
substring(isnull(notetext,''), 128001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 136000 then
substring(isnull(notetext,''), 136001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 144000 then
substring(isnull(notetext,''), 144001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 152000 then
substring(isnull(notetext,''), 152001, 8000)
else '' end ) +
(case when isnull(datalength(notetext), 0) > 0 then
char(13) + char(10)
else '' end) +
isnull(@note,'')
where case_no=@case;
commit;
FETCH NEXT FROM notes_cursor into @case, @lineno, @note;
END
CLOSE notes_cursor;
DEALLOCATE notes_cursor;

View 3 Replies View Related

Replication - TEXT Field

Dec 30, 1998

I have a table that has a TEXT field and I want to replicate it. It already has a primary key field in it. I read that in SQL Server 6.5, you can do transactional replication on a table that has a TEXT field in it. I'm wondering if I need to do any other special configuration to replicate this table, i.e. enable the truncate on checkpoint option or anything else? Thanks, Hoang

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved