UpdateText() Not Working Correctly On Ntext Column

May 25, 2006

I'm trying to run the following SQL against my ntext column, Testtbl.Task

I want to replace where the ampersand sign got HTML encoded to  
"&", and I want to strip it down to only the ampersand sign and delete
the "amp" and the ";".

It executes, but I still have the HTML encoding for the ampersand sign if the issue is NOT the first character in the ntext column.  If it's the first part of the ntext column, then it works.

View 5 Replies


ADVERTISEMENT

UpdateText() Not Working

May 25, 2006

I'm trying to run the following SQL against my column, Testtbl.Task

I want to replace where the ampersand sign got HTML encoded to
"&", and I want to strip it down to only the ampersand sign and delete the "amp" and the ";", that's why my parameters for the UpdateText are 0 and 8 with no update text value.


It executes, but I still have the HTML encoding for the ampersand sign.


USE WI
GO
EXEC sp_dboption 'WI', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(Task)
FROM Testtbl
WHERE Task like '%amp;%'
UPDATETEXT Testtbl.Task @ptrval 0 8
GO
EXEC sp_dboption 'WI', 'select into/bulkcopy', 'false'
GO

View 1 Replies View Related

Sql Not Working Correctly

Mar 30, 2004

and (jobs.ApplicationsClosed > getdate() OR jobs.ApplicationsClosed = getdate())


The above statement does not pick jobs.ApplicationsClosed= 3/30/2004(that is today'sdate)
If I change 3/30/2004 to 3/31/2004 it picks it up. What is wrong with my syntax?

Thanks!

View 2 Replies View Related

Sum Not Working Correctly

Oct 12, 2007

Hi,
I have the following simple SP..

There is a field which I'm doing a sUM() on to get a total for a QtyRecieved from one of the tbls in the SP..
However, the QtyRecieved field is set to be a two decimal place numeric field.


The sp works fine without issues until on the of the qty received is not a round number.

If it's a number with a decimal in it (i.e 5.5) then this is show as a seperate result and not SUM'd with the others.

Any ideas why?

SELECT PDS_Login.Supplier_Products.ProductName, PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID,
dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, dbo.Suppliers_POs_Details.PricePerItem,
dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived,
PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID,
dbo.Suppliers_POs_Details.PODetailsStatusReason, SUM(dbo.Suppliers_POs_Details_Received.Qty) AS QtyReceived
FROM PDS_Login.Supplier_Products INNER JOIN
dbo.Suppliers_POs_Details ON PDS_Login.Supplier_Products.ProductID = dbo.Suppliers_POs_Details.ProductID RIGHT OUTER JOIN
dbo.Suppliers_POs_Details_Received ON dbo.Suppliers_POs_Details.PODetailsID = dbo.Suppliers_POs_Details_Received.PODetailsID
GROUP BY dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, PDS_Login.Supplier_Products.ProductName,
PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID, dbo.Suppliers_POs_Details.PricePerItem,
dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived,
PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID,
dbo.Suppliers_POs_Details.PODetailsStatusReason, dbo.Suppliers_POs_Details_Received.Qty
HAVING (dbo.Suppliers_POs_Details.POID = @POID)

View 10 Replies View Related

SubQuery Not Working Correctly.

Apr 14, 2008

I've recently just got started using sub queries. The sub query that I'm running is supposed to select distinct values out of a table. It doesn't seem to be working though.


SELECT id
FROM data
WHERE (issueID IN
(SELECT DISTINCT issueID
FROM data))


When I execute this query, it returns a list of id's, but they don't each have a unique issueID. In the data table, issueID can appear more than once (hence, I need to use distinct). However, id is the primary key, and is unique.

Any ideas?

View 7 Replies View Related

SP Not Working Correctly? When Called From App

May 3, 2006

Hi

In a stored procedure the following code snippet 1 checks against duplicate data being inserted. I've tested it with snippet 2 and it works as expected. However, when the procedure is called from ASP.NET the check seems ineffective. I still get the error msg. The application uses a SqlDataSource with the following parameters.

Any suggestions?

Thanks,

Bakis.

PS I want to ask a question on the ASP.NET forum .The login/pwd for this forum "get me in" to the .net forum in the sense that when I log in I see a logout link. I don't get an "ask a question" button though. Is there a separate screening for each forum?

<UpdateParameters>

<asp:Parameter Name="CatItemUID" Type="Int32" />

<asp:Parameter Name="CatName" Type="String" />

<asp:Parameter Name="Item" Type="String" />

<asp:Parameter Name="Quad" Type="Int16" />

<asp:Parameter Name="UID" Type="Int64" />

</UpdateParameters>



snippet 1 :

if (@CatItemComboExists > 0 )
BEGIN
--print @CatItemComboExists
return 0
END

snippet 2:

begin tran
declare @return_status int
EXECUTE @return_status = spUpdateCatItemRec 343, 'blah','blih', 2,3
print @return_status
rollback

error msg only if proc is called from app

Violation of UNIQUE KEY constraint 'IX_tblCatItemUID'. Cannot insert duplicate key in object 'tblCatItemUID'.

View 3 Replies View Related

Asp.Net Login Control Not Working Correctly...

Oct 4, 2007



Ok.. I have a web site I am developing in Visual Studio 2005. Its VB based with SQL Server 2005 as the backend. IIS 6 is the web engine and all of this is running on a Windows 2003 Server.

Here is the problem.. I have a form that authenticates a user and then redirects them to another page. The redirection is not working. All I get is 'Your login attempt was not successful. Please try again.' So I decided to trouble shoot a little and I added a Forgot your password control and a Sign up for new account control to the page as well. When I do the Forgot my password it sends me the username and password in an email, but it just refuses to accept them.

If I use the sign up for a new account control it actually lets me into the redirect page but if I log out and try to get back in it fails. Its crazy and if driving me out of my mind.

If someone wants to help me out I would appreciate it. I have been racking my brain over this for too many days.

Thanks in advance...

Mark

Ps. - I have read every thread and tried just about everything regarding this issue. It has to be something stupid and simple that I am overlooking.

View 8 Replies View Related

SQL Agent Not Working Correctly, Returns 14266

Jun 2, 2004

exec msdb..sp_help_jobhistory @mode = 'SUMMARY'
Server: Msg 14266, Level 16, State 1, Procedure sp_help_jobhistory, Line 79
The specified '@mode' is invalid (valid values are: SUMMARY, FULL, SEM).

When I double-click to open a job in EM, I get the same error message, but with a different content:

Error 14266: The specified '@class' is invalid (valid values are: JOB, ALERT, OPERATOR).

Any suggestions.
Thanks Lennart

View 1 Replies View Related

Color Property Formatting Not Working Correctly

Apr 30, 2007

Hi,



I have a problem with a conditional format of the Color property in a matrix report. When the value of the textbox is greater than 0, the color should be Red otherwise it should be Blue. This is implemented via an IIF statement and works perfectly in Preview in Visual Studio 2005.



When the report is deployed, the formatting appears to be ignored and all values are the default value of Black.



Anyone else experienced this problem and, if so, is there a workaround?



View 3 Replies View Related

Reporting Services :: SSRS 2008 - Row Visibility Is Not Working Correctly

Mar 2, 2012

VS 2008. I have the following set up. Group1, Group2, Group3 header, Group 3 detail rows..When I set the row visibility (hide based on Group2) on the Detail row, it still shows up when the report is originally rendered.

It should be: Group1 expanded, Group2 collapsed, Group3 header hidden and detail rows hidden
It is showing: Group1 expanded, Group2 collapsed, Group3 header hidden, Group3 detail row visible.

I never had this trouble in 2005. Is there something different about row visibility in 2008?

View 3 Replies View Related

Sending Email Reminder To Multiple Users - Cursor Not Working Correctly?

Sep 18, 2014

I am tring to send an email reminder to multiple users using a cursor.

declare emailCursor cursor for
select name,info,default_email, @MyMessage
from My_Temp

open emailCursor
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage

while(@@FETCH_STATUS = 0)
begin

-- select name,info,ins_default_email,@MyMessage
--from temp

EXEC msdb.dbo.sp_send_dbmail

@profile_name = 'Hello',
@recipients = @Recipients,
@from_address = '<address.com>',
@Body = @MyMessage,
@subject = 'Subject'

fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage

end
close emailCursor
deallocate emailCursor

Currently I have two users in my table that I want to send email to, but when the stored procedure runs I got two emails for the last user in the table instead one for each user.

View 2 Replies View Related

Problems With The Query, ResultSet Property Not Set Correctly, Parameters Not Set Correctly, Or Connection Not Established Cor

Oct 22, 2007



I have the following query in an ExecuteSQL Task:

Insert Into Table2
Select * From Table1 Where Column1Val = '4'


As you can see, I don't need any parameters so I havent configured any. Also, there should not be any result set so I shouldnt need to configure a resultset parameter.

Why is the above query failing with

Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly

View 4 Replies View Related

Column Size For Ntext

Aug 11, 2005

Hi,

Please help me to find out the ntext column size in a table.

Thanks in advance

Regards

Karthik

View 2 Replies View Related

Two Tables Have A Column In The Same Name. It Didn't Output Correctly

May 16, 2007

I have a very weird problem.

I ran a SQL statement to get the data from two tables using join. These two tables have a column in the same name €œID€?.

SQL=€?select * from table1 a, table2 b where a.ID=b.ID€?
Set RS=DB.Execute(SQL)

The statement worked. But when I output the records in my ASP pages, I got an error:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal€?

This is the line caused error:
<%= RS(€œa.ID€?) %>

It seemed that SQL Server recordset doesn€™t carry the table aliens. If I removed a. from ID the error was gone but it gave me the value of b.ID.

How to solve the problem? Thank you.

View 4 Replies View Related

Matrix Column Header Tb-rl Does Not Wrap Correctly

Apr 25, 2008



The text in my matrix column headers is rendered as tb-rl.

The te
xt is spl
it at rand
om places whi
ch is really ver
y annoying

Is this a known bug?

Is there a workaround?

View 4 Replies View Related

Get Length Of Data In An NText Column

Feb 27, 2004

I have some text in an NText column that could be quite long.

for the web page that displays it, i want to show the first 200 characters and then have a "more..." link to bring up the full text.

i'd like to create a stored procedure that takes the left 200 characters and copies them to a ShortText column (NVarChar) for initial display and then id like to set a bit column to indicate if the length of the NText column is greater than 200.

Len and Left cant be used against NText so how can i work with the NText data ??

View 2 Replies View Related

SSIS, Problem Getting The Ntext Column Value

Mar 14, 2008



Hi,

I have an SSIS Package where I am looping through all input columns and creating an XML out of it. The Problem comes in one of the tables where I have an Ntext column. Instead of giving me the value of the column, it gives me
"Microsoft.SqlServer.Dts.Pipeline.BlobColumn"

I am trying to get the string value from this blob column. For that I am using the below code. Can you please point me to where I am going wrong. I am not very good in VB so I might be doing some casting error.

Dim blobCol As Microsoft.SqlServer.Dts.Pipeline.BlobColumn

Dim ByteVal As String


For Each column In Me.ComponentMetaData.InputCollection(0).InputColumnCollection


columnValue = rowType.GetProperty(column.Name)

Select Case column.DataType

Case (DataType.DT_NTEXT)


blobCol = DirectCast(columnValue.GetValue(Row, Nothing), Microsoft.SqlServer.Dts.Pipeline.BlobColumn)

ByteVal = System.Text.Encoding.Unicode.GetString(blobCol.GetBlobData(0, CInt(blobCol.Length)))

newXML += ((FormatElement(column.Name) + ReplaceSpecialChars(ByteVal) + FormatElement(column.Name, True)))

Case Else


newXML += ((FormatElement(column.Name) + ReplaceSpecialChars(columnValue.GetValue(Row, Nothing).ToString()) + FormatElement(column.Name, True)))

End Select

Next

Thanks in advance.
Regards

View 8 Replies View Related

Problem Accessing A Column Of Type Ntext

Jan 16, 2007

Hi,
I am working on an application which accesses SQL database. I have a table complaint in which i have a coulmn 'history' of type "ntext". When i insert a value, the value gets stored in the db correctly, but I cannot access the complete data from that field using a simple select query. I had to export the table to a text file only then i could view the complete data of the field.
I wrote the query in query analyzer as:
"select history from complaint where pkey=142"
& the result i got is:
"
###### admin: Jan 8, 2007 3:53:57 PM GMT Type: Inactive (Key 10) Description: Activity yet to be started State: Planned "

This is only a part of the entire string that I had entered.

My requirement is that I need to access the data from the ntext field & save it in a variable & then display the entire data in my application. Can anyone tell me how should i use the select query so that i get the entire data without having to go thru the export data procedure.
Please help!!!

View 2 Replies View Related

NText Column Text Encoding/decoding

Sep 19, 2007

Hi,

I have a table column type as nText, however there are some Chinese character stored in that field and it is a messed up as it is not readable.

In my vb.net code, I did Convert to unicode by getting the byte of each character and encode it with UTF8 e.g:


Public Shared Function ConvertToUnicode(ByVal s As String) As String


' Convert To Unicode

Dim MyBytes As Byte() = Encoding.Default.GetBytes(s)

Dim GBencoding As Encoding = System.Text.UTF8Encoding.UTF8

Return GBencoding.GetString(MyBytes)

End Function


This works well but ,the problem is that it slows down the process quite alot, and I wonder are there any text encoding method I can use in SQL that can run when i do the SELECT Statement?


SELECT
Convert(MyNTEXTColumn)
....
something like that?

Thanks.
Jon

View 4 Replies View Related

Basic Query: Alternatives To 'Group By' For NText Column

Apr 19, 2004

I am having some difficulty writing a relatively basic query. The objective is to retrieve the new stories (headlines) for the past 3 days from the database. Since each headline can be assigned multiple categories (topics) the query returns a row for every headline assignment. I can't use the 'Group By' expression because one of the columns is nText.

So basically if there is an article written yesterday, "I Love Cats" that gets assigned both topics 'CATS' and 'PETS' I only it returned with the first topic assigned... 'CATS'. Here is a little image of the three tables being called:

http://64.225.154.232/temp_dbDiagram.gif

I don't think that this query is too difficult, but I'm just getting my feet wet with writing queries that are more than select * from whatever. Any insight or recommendations are greatly appreciated.


SELECT headline.HEADLINE_ID, headline.HEADLINE_TITLE, headline.HEADLINE_DATE, headline.HEADLINE_THUMBNAIL,
topic.TOPIC_NAME, topic.TOPIC_URL
FROM tbl_CCF_Headlines headline INNER JOIN
tbl_CCF_Headlines_Topics ON headline.HEADLINE_ID = tbl_CCF_Headlines_Topics.HEADLINE_ID INNER JOIN
tbl_CCF_Topics topic ON tbl_CCF_Headlines_Topics.TOPIC_ID = topic.TOPIC_ID
WHERE (headline.HEADLINE_DATE IN
(SELECT TOP 3 HEADLINE_DATE
FROM tbl_CCF_HEADLINES
GROUP BY HEADLINE_DATE
ORDER BY HEADLINE_DATE DESC))
ORDER BY headline.HEADLINE_DATE DESC

View 2 Replies View Related

#Error Displayed In Ntext Column Exported To Excel

Nov 28, 2007



Hi,

I have exported a report to excel that contains an ntext column. The exported excel file shows "#Error" for the ntext column in some of the rows. If I see the same report in reporting services I don't see any problem. I have checked that this is not any issue with the length of the text. Could you suggest me something on this?

Thanks
Soni

View 5 Replies View Related

Transact SQL :: Split A Column Which Contains Ntext Values Separated With Value

Jul 13, 2015

SQL syntax to split a column that contains ntext values that are separated with this value : ;#

I need it to create 3 new columns

i.e.: I have a column that contains values such as:

ROW1: ;#typea;#typeb;#typec;#typed;#
ROW2: ;#typeb;#typec;#
ROW3: ;#typeb;#

I need it to convert to 3 new columns and strip out the ;#:

E.g.:

Column 1
typea
typeb
typeb

Column 2
typeb
typec
blank

View 16 Replies View Related

Function That Replaces Ntext And Compares Ntext With Nvarchar

Nov 28, 2007

I am running this query to an sql server 2000 database from my aspcode:"select * from MyTable whereMySqlServerRemoveStressFunction(MyNtextColumn) = '" &MyAdoRemoveStressFunction(MyString) & "'"The problem is that the replace function doesn't work with the ntextdatatype (so as to replace the stresses with an empty string). I hadto implement the MySqlServerRemoveStressFunction, i.e. a function thattakes a column name as a parameter and returns the text contained inthis column having replaced some letters of the text (the letters withstress). Unfortunately, I could not do that because user-definedfunctions cannot return a value of ntext.So I have the following idea:"select * from MyTable whereCheckIfTheyAreEqualIngoringTheStesses(MyNtextColum n, '" & MyString &"')"How can I implement the CheckIfTheyAreEqualIngoringTheStessesfunction? (I don't know how to combine these functions to do what Iwant: TEXTPTR, UPDATETEXT, WRITETEXT, READTEXT)

View 2 Replies View Related

Way To Retrieve Actual Size Of Ntext Column In Native Code?

Aug 3, 2007

Howdy folks! (I feel im creating too many topics...but all my questions are unrelated :-/)

Dev environment: SSCE, Native c++ OLE code, Win CE 5

I have a routine that calculates the size of a set of columns in order to create a byte buffer for retrieving data from an IRowset and inserting it into a custom class. This method works great for all data types except ntext. When I look at the column information from an ntext field, the DBCOLUMNINFO::ulColumnSize member holds 536,870,911 (the max length of an ntext type). Obviously I dont want to allocate 1GB of memory for each ntext column. Is there anyway (natively) to determine the actual number of characters in a field?

View 12 Replies View Related

Reporting Services :: Unable To Calculate Running Balance Column Correctly In SSRS

Oct 7, 2015

I created a view that i want to use in ssrs.In the view there is a column for running balance.In the table contain transaction of inventory with their quantity.

"SELECT     TOP (100) PERCENT ITEMNMBR, TRXSORCE, DOCTYPE, DOCNUMBR, DOCDATE, HSTMODUL, UOFM, UNITCOST, EXTDCOST, TRXQtyInBase,
                          (SELECT     SUM(TRXQtyInBase) AS Expr1
                            FROM          dbo.INVTRXB AS b
                            WHERE      (DEX_ROW_ID <= a.DEX_ROW_ID) AND (ITEMNMBR = a.ITEMNMBR)) AS ENDQTY
FROM         dbo.INVTRXB AS a
ORDER BY ITEMNMBR, DOCDATE"

If i run the query on sql or use the view on ssr. The end qty is  not showing accurately.I ran it on another database it works perfectly. Then i noticed that the dex_row_ID of the second database is sequential as the date. But for the initial database it was not sequential as with the date.

View 4 Replies View Related

Updatetext

Oct 5, 2000

Help,
I am trying to update 1000 rows. They have the wrong extension of an image file and I'd like to change the extension only. I have tried using the following code


declare @ptrval binary(16)
select @ptrval = textptr(images)
from copyimages
where images like '%.jpgg%'
updatetext copyimages.images @ptrval 8 5 with log '.jpg'
go


This works but it only updated one record. I would like it to update all the records. I have tried using a counter with nocount on but I am getting an error. Can anyone please tell me how to go about that??

Also how would I go about it if the image names were not the same length?

I would appreciate any help I can get.
Thank you
JG

View 2 Replies View Related

UPDATETEXT

Jun 8, 2006

in SQL 2000 & 2005 : does UPDATETEXT invoke UPDATE TRIGGER.

View 1 Replies View Related

How Do I Handle REPLACE A Particuler Matched String Within An NTEXT Column In SQL Server?

Mar 27, 2008

Hi!
I recently was confronted with a problem where a piece of text that was included in many NTEXT column values in a table needed to be replaced with another piece of text. You can't issue normal REPLACE statements against NTEXT columns, so this seemed to be a bit of a challenge €” issuing a REPLACE() against a TEXT or NTEXT column in SQL Server yields error

I tried following

UPDATE CaseTypeDefs SET definition = replace(LTRIM(RTRIM(definition)), '<![CDATA[sp_YOTAssetAdditionalOffences 0, ArgParamHearingsId, ArgParamLanguage, ArgParamReferralId]]>', '<![CDATA[sp_YOTAssetAdditionalOffences 0, ArgParamHearingsId, ArgParamLanguage]]>')


But this is producing following error

Server: Msg 8116, Level 16, State 1, Line 1Argument data type ntext is invalid for argument 1 of replace function.

For Example: I want to replace string <![CDATA[sp_YOTAssetAdditionalOffences 0, ArgParamHearingsId, ArgParamLanguage]]> with <![CDATA[sp_YOTAssetAdditionalOffences 0, ArgParamHearingsId, ArgParamLanguage, ArgParamReferralId]]> in NTEXT column values in a table.

Need help, how to do it?.


Thanks In Advance

Devloper
Anil Kumar Dwivedi

View 4 Replies View Related

UPDATETEXT, WRITETEXT

Jun 11, 2007

I need to update/change the text in a table column of data type TEXT.It's a smaller set of records (72) where I need to append onto the enda string of text, the same for all records.I don't quite understand how UPDATETEXT and WRITETEXT work, but hereis how I would write the Update query were the field not a TEXT type.Update Matters Set Description = Description + ' (Stylized)'


Quote:

View 5 Replies View Related

UPDATETEXT Question

Feb 21, 2008

I have a question on the UPDATETEXT function (SQL 2000)The below query works and only updates the record where p.pub_id =pr.pub_id.I just don't quite understand why only 1 record is updated when theUPDATETEXT statementdoes not specify anything except pointer value. Is it no possible for 2rows in a table with a text column to have the same pointer value?Does this query scan all pr_info in the pub_info table?USE pubsGOEXEC sp_dboption 'pubs', 'select into/bulkcopy', 'true'GODECLARE @ptrval binary(16)SELECT @ptrval = TEXTPTR(pr_info)FROM pub_info pr, publishers pWHERE p.pub_id = pr.pub_idAND p.pub_name = 'New Moon Books'UPDATETEXT pub_info.pr_info @ptrval 88 1 'b'GOEXEC sp_dboption 'pubs', 'select into/bulkcopy', 'false'GOAlso, what is the importance of 'select into/bulkcopy', 'true' ?Thanks

View 3 Replies View Related

Syntax For Updatetext

Jul 20, 2005

hello,i would like to update a column called footer in a table calledagency. i have to update about 60 different records in this table.footer is varchar(200)i would like to search for "<table bgcolor="#cccccc"" and replace itwith "<table "there is stuff before and after the start of the table tag.i looked at the books online and could not get the syntax correct.am i using the right command? updatetext, or should i do this with aloop?thanks in advance.nicholas.gadacz

View 3 Replies View Related

Transact SQL :: Get Multiple Rows Based On Comma-separated Ntext List In On Column?

Jun 2, 2015

I have a table that is used to build rules. The rules point to other columns in other tables and usually contain only one value (i.e. ABC). But one of the options is to add a comma-separated list of SSNs (i.e. 123123123,012012012,112231122).  I am trying to build a single query that allows me to leverage that list to get multiple rows from another table.

This obviously works:

SELECT * FROM vw_Person_Profile P (NOLOCK)
WHERE P.PrsnPIISSN_Chr IN ('123123123','012012012','112231122')

But this does not:

SELECT * FROM vw_Person_Profile P (NOLOCK)
WHERE P.PrsnPIISSN_Chr IN (
SELECT '''' + REPLACE(CONVERT(VARCHAR(4000),txtFieldValue), ',', ''',''') + ''''
FROM MassProcessing_Rules PR
WHERE PR.intRuleID = 10
)

View 5 Replies View Related

Problem With Updatetext In SQL 2000 Trying To Concatenate Multiple Text Fields

Jan 2, 2007

Hi all, I am creating a search table where the keywords field is madeup of several text fields and this is causing me some problems. I canconcatentate the text ok but i can't seem to concatenate matchingrecords here is the cursor loop. I'm not a fan of cursors but alsodidn't see another way of achieving this.declare @ptr1 varbinary(16)declare @Ptr2 varbinary(16)declare @profileid intdeclare @x intset @profileid = 0while @profileid is not nullbeginselect@profileid = min([id]),@ptr1 = MIN(textptr(text1))from #holdingwhere [id] @profileiddeclare c2 cursor fast_forward forselect textptr(searchterms), datalength(searchterms)from searchwhere search.[id] = @profileidopen c2fetch c2 into @ptr2, @xwhile @@fetch_status = 0beginupdatetext search.searchterms @ptr2 null 0 #holding.text1 @ptr1fetch c2 into @ptr2, @xendclose c2deallocate c2endThe #holding table contains the fields that i want to concatenate andthe search table is the resulting table. This example would loopthrough search and find id 1 in search and then append another fieldmatching id 1 in holding then move onto the next field in turn goingthrough the whole table.i.e.search holding result after each loopid text id text1 abc 1 def abcdef2 ghi 2 jkl ghijklWhen I run this, some of the records concatenate properly but most dontwith the same text being appended to the end of searchterms. i.e loadsof results will end up with jkl tagged onto the end. I can't figure outwhen my loop is falliing over!!! Can anyone help?Dan

View 4 Replies View Related







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