Thursday, March 22, 2012
arabic Problem
After exporting the report to pdf format ,The arabic text
Disappear.
even the settings of the machine are set to arabic default
Plz adviceRight to left languages (Arabic, Hebrew) in PDF were not implemented in the
initial release of Reporting Services. This will work in the upcoming SP1.
--
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
<anonymous@.discussions.microsoft.com> wrote in message
news:1ee7401c456ca$08c6df10$a501280a@.phx.gbl...
> hello
> After exporting the report to pdf format ,The arabic text
> Disappear.
> even the settings of the machine are set to arabic default
> Plz advice
>sql
arabic and hebrew search
am having a problem in searching the database which contains arabic and hebrew text, while the english search works just fine, the arabic and hebrew always return no match. the data is stored and utf-8 the website is atwww.allforpeace.org .
is their a way to encode the text or what ever ...!! i need help
can u provide some code plz
Regards
|||Hi,
If you're searching with parameters, make sure that the parameter type is NVarChar or NChar which accepts unicode. Or the search will not return good results.
HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!
Arabic and Far East text saving as
posted using either Arabic or Far East characters the only thing that shows
up is a series of ? marks. These question marks also appear through SQL
Reporting Services. This haapens when the text is added via ad-hoc insert
query or though a SP.
I can open SQL Management Studio, open the table and insert the Arabic or
Chinese character ditectly into the table and the Arabic or Chinese text
will appear correctly in SQL Reporting Services.
The system configuration is:
SQL 2005 Standard
Windows Server 2003 Standard SP1
The table fields are delcared as NVARCHAR and all the parameters in the SP
are NVARCHAR as well.
Any ideas on how to resolve this?
Thank you
Marc HensleyAre the comment strings preceded by the 'N' prefix? For example, see
http://support.microsoft.com/?kbid=239530. Though targeted to earlier
versions, it still applies to SQL Server 2005.
David Barber [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Marc Hensley" <marc.hensley@.newsgroups.nospam> wrote in message
news:%23RYrtjGRGHA.2436@.TK2MSFTNGP11.phx.gbl...
> I have a database that captuers user comments, however when comments are
> posted using either Arabic or Far East characters the only thing that
shows
> up is a series of ? marks. These question marks also appear through SQL
> Reporting Services. This haapens when the text is added via ad-hoc insert
> query or though a SP.
> I can open SQL Management Studio, open the table and insert the Arabic or
> Chinese character ditectly into the table and the Arabic or Chinese text
> will appear correctly in SQL Reporting Services.
> The system configuration is:
> SQL 2005 Standard
> Windows Server 2003 Standard SP1
> The table fields are delcared as NVARCHAR and all the parameters in the SP
> are NVARCHAR as well.
> Any ideas on how to resolve this?
> Thank you
> Marc Hensley
>|||Thank You -- That is what it was. Sent the issue back to the ASP Guys to
correct.
Marc
"David Barber [MS]" <dbarber@.microsoft.com> wrote in message
news:exhfbjHRGHA.4572@.TK2MSFTNGP10.phx.gbl...
> Are the comment strings preceded by the 'N' prefix? For example, see
> http://support.microsoft.com/?kbid=239530. Though targeted to earlier
> versions, it still applies to SQL Server 2005.
> --
> David Barber [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Marc Hensley" <marc.hensley@.newsgroups.nospam> wrote in message
> news:%23RYrtjGRGHA.2436@.TK2MSFTNGP11.phx.gbl...
> shows
>sql
Monday, March 19, 2012
Applying Full Text on a document whose path is stored in the database
Can we create full-text index on a document that resides on a file system and we have got the path to that document in the database.
Thanks and regards
Salil
I don't think you can do this in current versions of SQL, though i have seen it suggested for future versions. Whether it will be in 2008 or not is probably a question for the Katmai forum.
In saying that, I think a possible workaround is to use Index Server to index your documents which can then be queried via a linked server.
Of course, you are able to store the documents in an IMAGE/VARBINARY(MAX) column which can be fulltext indexed.
HTH!
Applying Full Text on a document whose path is stored in the database
Can we create full-text index on a document that resides on a file system and we have got the path to that document in the database.
Thanks and regards
Salil
I don't think you can do this in current versions of SQL, though i have seen it suggested for future versions. Whether it will be in 2008 or not is probably a question for the Katmai forum.
In saying that, I think a possible workaround is to use Index Server to index your documents which can then be queried via a linked server.
Of course, you are able to store the documents in an IMAGE/VARBINARY(MAX) column which can be fulltext indexed.
HTH!
Sunday, March 11, 2012
Applying a diagonal line in a report
My client cannot workout how to apply diagonally aligned text on a report.
We need to apply the text on statements and invoices to alert the clients to accelerate their payment, or notify them of account issues.
Could someone please tell me where I could find the information required to do this so I can forward it to the client.
I don't know how to do this, but this concept is typically referred to as adding a "watermark". HTH your searching for an answerApply a long list of SQL Statements
create all necessary tables as well as inserting all the data into this
table
Using the Enterprise Manager how can I apply all these statements?
Thank you,
SamuelSamuel
> Using the Enterprise Manager how can I apply all these statements?
Why ? open a query analyzer and run this statement (modify it for your
needs)
EXEC master..xp_cmdshell
'osql -S<yourServer> -U<user> -P<password> -iC:\File.sql -n '
"Samuel Shulman" <samuel.shulman@.ntlworld.com> wrote in message
news:O1$a3wzfGHA.2032@.TK2MSFTNGP02.phx.gbl...
>I just received a long text file that contains all statements required to
>create all necessary tables as well as inserting all the data into this
>table
> Using the Enterprise Manager how can I apply all these statements?
> Thank you,
> Samuel
>|||copy the info into query analyzer and execute it there.
"Samuel Shulman" wrote:
> I just received a long text file that contains all statements required to
> create all necessary tables as well as inserting all the data into this
> table
> Using the Enterprise Manager how can I apply all these statements?
> Thank you,
> Samuel
>
>|||On Wed, 24 May 2006 17:22:51 +0300, Uri Dimant wrote:
>Samuel
>> Using the Enterprise Manager how can I apply all these statements?
>Why ? open a query analyzer and run this statement (modify it for your
>needs)
>EXEC master..xp_cmdshell
>'osql -S<yourServer> -U<user> -P<password> -iC:\File.sql -n '
Hi Uri,
Ir you're going to use osql.exe, why use Query Analyzer at all? Just
open a DOS prompt (or command window, or whatever it is called now).
For better ability to view the output, I'd recommend either adding an
output file to the osql command (using the -o parameter), or switching
to Quary Analyzer, copying in the text of the script, then hitting the
Execute button.
--
Hugo Kornelis, SQL Server MVP|||Hugo
> Ir you're going to use osql.exe, why use Query Analyzer at all? Just
> open a DOS prompt (or command window, or whatever it is called now).
Don't you see people who was wrapping this command into a stored procedure
and run in within a job or whatever?
"Hugo Kornelis" <hugo@.perFact.REMOVETHIS.info.INVALID> wrote in message
news:a0h972p5rpockl0n8v38sabjlbkg57ejls@.4ax.com...
> On Wed, 24 May 2006 17:22:51 +0300, Uri Dimant wrote:
>>Samuel
>> Using the Enterprise Manager how can I apply all these statements?
>>Why ? open a query analyzer and run this statement (modify it for your
>>needs)
>>EXEC master..xp_cmdshell
>>'osql -S<yourServer> -U<user> -P<password> -iC:\File.sql -n '
> Hi Uri,
> Ir you're going to use osql.exe, why use Query Analyzer at all? Just
> open a DOS prompt (or command window, or whatever it is called now).
> For better ability to view the output, I'd recommend either adding an
> output file to the osql command (using the -o parameter), or switching
> to Quary Analyzer, copying in the text of the script, then hitting the
> Execute button.
> --
> Hugo Kornelis, SQL Server MVP|||On Thu, 25 May 2006 09:43:06 +0300, Uri Dimant wrote:
>Hugo
>> Ir you're going to use osql.exe, why use Query Analyzer at all? Just
>> open a DOS prompt (or command window, or whatever it is called now).
>Don't you see people who was wrapping this command into a stored procedure
>and run in within a job or whatever?
Hi Uri,
Since Samuel asked "how to apply these statements (...) using Enterprise
Manager", I figured he wanted to do it manually, not to schedule it.
Also, scripts that contain CREATE TABLE statements should normally run
just once.
--
Hugo Kornelis, SQL Server MVP
Apply a long list of SQL Statements
create all necessary tables as well as inserting all the data into this
table
Using the Enterprise Manager how can I apply all these statements?
Thank you,
SamuelSamuel
> Using the Enterprise Manager how can I apply all these statements?
Why ? open a query analyzer and run this statement (modify it for your
needs)
EXEC master..xp_cmdshell
'osql -S<yourServer> -U<user> -P<password> -iC:\File.sql -n '
"Samuel Shulman" <samuel.shulman@.ntlworld.com> wrote in message
news:O1$a3wzfGHA.2032@.TK2MSFTNGP02.phx.gbl...
>I just received a long text file that contains all statements required to
>create all necessary tables as well as inserting all the data into this
>table
> Using the Enterprise Manager how can I apply all these statements?
> Thank you,
> Samuel
>|||copy the info into query analyzer and execute it there.
"Samuel Shulman" wrote:
> I just received a long text file that contains all statements required to
> create all necessary tables as well as inserting all the data into this
> table
> Using the Enterprise Manager how can I apply all these statements?
> Thank you,
> Samuel
>
>|||On Wed, 24 May 2006 17:22:51 +0300, Uri Dimant wrote:
>Samuel
>Why ? open a query analyzer and run this statement (modify it for your
>needs)
>EXEC master..xp_cmdshell
>'osql -S<yourServer> -U<user> -P<password> -iC:\File.sql -n '
Hi Uri,
Ir you're going to use osql.exe, why use Query Analyzer at all? Just
open a DOS prompt (or command window, or whatever it is called now).
For better ability to view the output, I'd recommend either adding an
output file to the osql command (using the -o parameter), or switching
to Quary Analyzer, copying in the text of the script, then hitting the
Execute button.
Hugo Kornelis, SQL Server MVP|||Hugo
> Ir you're going to use osql.exe, why use Query Analyzer at all? Just
> open a DOS prompt (or command window, or whatever it is called now).
Don't you see people who was wrapping this command into a stored procedure
and run in within a job or whatever?
"Hugo Kornelis" <hugo@.perFact.REMOVETHIS.info.INVALID> wrote in message
news:a0h972p5rpockl0n8v38sabjlbkg57ejls@.
4ax.com...
> On Wed, 24 May 2006 17:22:51 +0300, Uri Dimant wrote:
>
> Hi Uri,
> Ir you're going to use osql.exe, why use Query Analyzer at all? Just
> open a DOS prompt (or command window, or whatever it is called now).
> For better ability to view the output, I'd recommend either adding an
> output file to the osql command (using the -o parameter), or switching
> to Quary Analyzer, copying in the text of the script, then hitting the
> Execute button.
> --
> Hugo Kornelis, SQL Server MVP|||On Thu, 25 May 2006 09:43:06 +0300, Uri Dimant wrote:
>Hugo
>Don't you see people who was wrapping this command into a stored procedure
>and run in within a job or whatever?
Hi Uri,
Since Samuel asked "how to apply these statements (...) using Enterprise
Manager", I figured he wanted to do it manually, not to schedule it.
Also, scripts that contain CREATE TABLE statements should normally run
just once.
Hugo Kornelis, SQL Server MVP
Saturday, February 25, 2012
application of fulltext search
of several key words? Which I mean, if I want to get to know "How rich is
Bill Gates?", I can simply enter this sentence instead of enter
"Bill+Gates+rich+how" in my search textbox. If it is applicable, how?I want
to rewrite the code of my blog
Thanks, indeed
Search is unable to interpret the context of your query. English Query has
rich context sensing abilities but it works against a database.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"SuperRock" <moyuji@.gmail.com> wrote in message
news:eTU999zbHHA.2188@.TK2MSFTNGP04.phx.gbl...
> Hello, It is possible to search text in my blog use a query sentence
> instead of several key words? Which I mean, if I want to get to know "How
> rich is Bill Gates?", I can simply enter this sentence instead of enter
> "Bill+Gates+rich+how" in my search textbox. If it is applicable, how?I
> want to rewrite the code of my blog
> Thanks, indeed
>
|||Does your blogging solution use SQL Server as the data store? Please
elaborate (give comprehensive examples, post DDL and sample data...).
ML
http://milambda.blogspot.com/
Friday, February 24, 2012
appending to the end of current file
ThanksDarren Green suggested in earlier posts that :
The text file provider does not support this. The simplest thing to do is to export to a new file, then use the DOS copy command to merge the files.
This can be done with the Execute Process Task, and any dynamic filename stuff can be handled with an ActiveX Script Task to change the connection and the Exec Proc Task at the same time.
copy FileOriginal.txt+FileNew.txt FileResult.txt
HTH|||That is what I am currently doing. I was hoping for something within the dts package. Thanks for you help.
val|||As suggested its not available using TEXT provider with DTS.
May be this is also other way around, is to export to an excel sheet and save that as text file.:)
Appending to a text file via DTS
Kindly let me know where I am going wrong.I am having the same issue as well... I thought I remember seeing an option checkbox somewhere to do that... but I cant seem to find it.
I doubt we are the only ones having to deal with this, so can someone please chime in with an answer or maybe a possible direction for us to follow? Thanks in advance... :)
Appending to a text field using UPDATE
UPDATE wr SET cf_notes = " + tmp_array(24) + " WHERE wr_id = " + data_temp(0)
I would like to add cf_notes + tmp_array(24) to cf_notes. Is this possible in SQL? If so, what is the correct syntax. I have tried 6 different statements and I get a compile error on every statement.
Thanks,
SBRcreate procedure spU_update_table_with_text (
@.key_field_value int,
@.text text = null)
as
declare @.txtptr binary(16), @.insert_offset int
select @.txtptr = textptr(text_field),
@.insert_offset = datalength(text_field) + 1 --or 2 if a space is needed
from your_table
where key_field = @.key_field_value
updatetext your_table.text_field @.insert_offset 0 @.text
return
Appending to a Text field
I am trying to append to a text (text data type) field in my database.
Simply put, the Customer table has a field called Notes. I want to append
some extra data to this field via TSQL. So for a Customer who has an ID of
1234, how do I append some extra text to his Notes field? The help in Books
on Line has me completely baffled.
Thank youWhich helo are you referring to? Have you looked at WRITETEXT/UPDATETEXT?
ML
http://milambda.blogspot.com/
Appending Text to a SQL Text Data Type
m
the selections from a series of VarChar(8000) values. I know I need to use
UpdateText, but it only seems to store the 1st one it reads. Can anyone hel
p?
Here's my text:
Declare @.TriggerText nVarChar(4000)
Declare @.ptrval Binary(16)
Declare @.Offset Int
-- Create temporary table to hold Text field
Create Table #tempTrigger
(TextField Text NULL)
Insert Into #tempTrigger Select ''
-- Get Trigger "basis"
Declare curTriggerBasis Insensitive Cursor For
Select c.Text
From sysObjects o (nolock)
Inner Join sysComments c (nolock)
On o.ID = c.ID
Where o.Name = 'cttx_Customer'
Order By ColID
For Read Only
Open curTriggerBasis
Fetch Next From curTriggerBasis Into @.TriggerText
While @.@.Fetch_Status = 0
Begin
Select @.ptrval = TEXTPTR(TextField),
@.Offset = DataLength(TextField)
From #tempTrigger (nolock)
UpdateText #tempTrigger.TextField @.ptrval @.Offset 0 @.TriggerText
Fetch Next From curTriggerBasis Into @.TriggerText
End
Close curTriggerBasis
Deallocate curTriggerBasis
Select * From #tempTrigger (nolock)> but it only seems to store the 1st one it reads
How are you determining this? What does 'SELECT DATALENGTH(TextField) FROM
#tempTrigger' return?
Happy Holidays
Dan Guzman
SQL Server MVP
"bobnunny" <u17151@.uwe> wrote in message news:59ac1c8e96b9c@.uwe...
>I am trying to use a cursor to create a mass Text field with the results
>from
> the selections from a series of VarChar(8000) values. I know I need to
> use
> UpdateText, but it only seems to store the 1st one it reads. Can anyone
> help?
> Here's my text:
> Declare @.TriggerText nVarChar(4000)
> Declare @.ptrval Binary(16)
> Declare @.Offset Int
> -- Create temporary table to hold Text field
> Create Table #tempTrigger
> (TextField Text NULL)
> Insert Into #tempTrigger Select ''
> -- Get Trigger "basis"
> Declare curTriggerBasis Insensitive Cursor For
> Select c.Text
> From sysObjects o (nolock)
> Inner Join sysComments c (nolock)
> On o.ID = c.ID
> Where o.Name = 'cttx_Customer'
> Order By ColID
> For Read Only
> Open curTriggerBasis
> Fetch Next From curTriggerBasis Into @.TriggerText
> While @.@.Fetch_Status = 0
> Begin
> Select @.ptrval = TEXTPTR(TextField),
> @.Offset = DataLength(TextField)
> From #tempTrigger (nolock)
> UpdateText #tempTrigger.TextField @.ptrval @.Offset 0 @.TriggerText
> Fetch Next From curTriggerBasis Into @.TriggerText
> End
> Close curTriggerBasis
> Deallocate curTriggerBasis
> Select * From #tempTrigger (nolock)|||I've put Print statements in there to check this out. It shows Datalength a
s
4000 everytime except the last one. BUT, like an idiot I was checking the
loop so hard, but the Select statement at the end will only return the first
4000. Once I changed that to DataLength, it showed it had it all.
Thanx!
Dan Guzman wrote:
>How are you determining this? What does 'SELECT DATALENGTH(TextField) FRO
M
>#tempTrigger' return?
>
>[quoted text clipped - 36 lines]
Sunday, February 19, 2012
Appending from one column to another for every row in a table
I need to carry out a database cleaning/maintenance operation whereby I
take the text in one column called ShortDescription and add it to the
text in a column called AdditionalDetails.
I know how to copy from one to the other but that would have the effect
of overwriting the values in the AdditionalDetails column. I need
whatever is in the first column to be simply appended to whatever is in
the second. If the first has null in it, nothing should happen, and I
guess if the second has a null in it, the null should be replaced with
whatever's in the second column.
Can anyone advise me on how to do this? I'm sure it must be a relatively
simple operation but I've never seen it done.
Thanks to anyone who can help
SimonUpdate table1 set additionaldetails = isnull(additionaldetails,'') +
shortdescription
where shortdescription is not null
Jay
Simon Harvey wrote:
> Hi there,
> I need to carry out a database cleaning/maintenance operation whereby I
> take the text in one column called ShortDescription and add it to the
> text in a column called AdditionalDetails
> I know how to copy from one to the other but that would have the effect
> of overwriting the values in the AdditionalDetails column. I need
> whatever is in the first column to be simply appended to whatever is in
> the second. If the first has null in it, nothing should happen, and I
> guess if the second has a null in it, the null should be replaced with
> whatever's in the second column.
> Can anyone advise me on how to do this? I'm sure it must be a relatively
> simple operation but I've never seen it done.
> Thanks to anyone who can help
> Simon|||You need concatenation, which is implemented using the + character.
UPDATE
SET AdditionalDetails = AdditionalDetails + ShortDescription
WHERE ShortDescription IS NOT NULL
The problem with the query above is that if AdditionalDetails is NULL
the concatenation ends up as NULL. So the more robust version would
be:
UPDATE
SET AdditionalDetails = COALESCE(AdditionalDetails, '') +
ShortDescription
WHERE ShortDescription IS NOT NULL
Roy Harvey
Beacon Falls, CT
On Wed, 13 Dec 2006 16:20:40 +0000, Simon Harvey
<nothanks@.hotmail.com> wrote:
>Hi there,
>I need to carry out a database cleaning/maintenance operation whereby I
>take the text in one column called ShortDescription and add it to the
>text in a column called AdditionalDetails.
>I know how to copy from one to the other but that would have the effect
>of overwriting the values in the AdditionalDetails column. I need
>whatever is in the first column to be simply appended to whatever is in
>the second. If the first has null in it, nothing should happen, and I
>guess if the second has a null in it, the null should be replaced with
>whatever's in the second column.
>Can anyone advise me on how to do this? I'm sure it must be a relatively
>simple operation but I've never seen it done.
>Thanks to anyone who can help
>Simon|||You are both SQL Stalions!
I knew it would be simple!
Thank you - you've been a great help
Kindest Regards
Simon
Appending from one column to another for every row in a table
I need to carry out a database cleaning/maintenance operation whereby I
take the text in one column called ShortDescription and add it to the
text in a column called AdditionalDetails.
I know how to copy from one to the other but that would have the effect
of overwriting the values in the AdditionalDetails column. I need
whatever is in the first column to be simply appended to whatever is in
the second. If the first has null in it, nothing should happen, and I
guess if the second has a null in it, the null should be replaced with
whatever's in the second column.
Can anyone advise me on how to do this? I'm sure it must be a relatively
simple operation but I've never seen it done.
Thanks to anyone who can help
Simon
Update table1 set additionaldetails = isnull(additionaldetails,'') +
shortdescription
where shortdescription is not null
Jay
Simon Harvey wrote:
> Hi there,
> I need to carry out a database cleaning/maintenance operation whereby I
> take the text in one column called ShortDescription and add it to the
> text in a column called AdditionalDetails
> I know how to copy from one to the other but that would have the effect
> of overwriting the values in the AdditionalDetails column. I need
> whatever is in the first column to be simply appended to whatever is in
> the second. If the first has null in it, nothing should happen, and I
> guess if the second has a null in it, the null should be replaced with
> whatever's in the second column.
> Can anyone advise me on how to do this? I'm sure it must be a relatively
> simple operation but I've never seen it done.
> Thanks to anyone who can help
> Simon
|||You need concatenation, which is implemented using the + character.
UPDATE
SET AdditionalDetails = AdditionalDetails + ShortDescription
WHERE ShortDescription IS NOT NULL
The problem with the query above is that if AdditionalDetails is NULL
the concatenation ends up as NULL. So the more robust version would
be:
UPDATE
SET AdditionalDetails = COALESCE(AdditionalDetails, '') +
ShortDescription
WHERE ShortDescription IS NOT NULL
Roy Harvey
Beacon Falls, CT
On Wed, 13 Dec 2006 16:20:40 +0000, Simon Harvey
<nothanks@.hotmail.com> wrote:
>Hi there,
>I need to carry out a database cleaning/maintenance operation whereby I
>take the text in one column called ShortDescription and add it to the
>text in a column called AdditionalDetails.
>I know how to copy from one to the other but that would have the effect
>of overwriting the values in the AdditionalDetails column. I need
>whatever is in the first column to be simply appended to whatever is in
>the second. If the first has null in it, nothing should happen, and I
>guess if the second has a null in it, the null should be replaced with
>whatever's in the second column.
>Can anyone advise me on how to do this? I'm sure it must be a relatively
>simple operation but I've never seen it done.
>Thanks to anyone who can help
>Simon
|||You are both SQL Stalions!
I knew it would be simple!
Thank you - you've been a great help
Kindest Regards
Simon
Appending from one column to another for every row in a table
I need to carry out a database cleaning/maintenance operation whereby I
take the text in one column called ShortDescription and add it to the
text in a column called AdditionalDetails.
I know how to copy from one to the other but that would have the effect
of overwriting the values in the AdditionalDetails column. I need
whatever is in the first column to be simply appended to whatever is in
the second. If the first has null in it, nothing should happen, and I
guess if the second has a null in it, the null should be replaced with
whatever's in the second column.
Can anyone advise me on how to do this? I'm sure it must be a relatively
simple operation but I've never seen it done.
Thanks to anyone who can help
SimonUpdate table1 set additionaldetails = isnull(additionaldetails,'') +
shortdescription
where shortdescription is not null
Jay
Simon Harvey wrote:
> Hi there,
> I need to carry out a database cleaning/maintenance operation whereby I
> take the text in one column called ShortDescription and add it to the
> text in a column called AdditionalDetails
> I know how to copy from one to the other but that would have the effect
> of overwriting the values in the AdditionalDetails column. I need
> whatever is in the first column to be simply appended to whatever is in
> the second. If the first has null in it, nothing should happen, and I
> guess if the second has a null in it, the null should be replaced with
> whatever's in the second column.
> Can anyone advise me on how to do this? I'm sure it must be a relatively
> simple operation but I've never seen it done.
> Thanks to anyone who can help
> Simon|||You need concatenation, which is implemented using the + character.
UPDATE
SET AdditionalDetails = AdditionalDetails + ShortDescription
WHERE ShortDescription IS NOT NULL
The problem with the query above is that if AdditionalDetails is NULL
the concatenation ends up as NULL. So the more robust version would
be:
UPDATE
SET AdditionalDetails = COALESCE(AdditionalDetails, '') +
ShortDescription
WHERE ShortDescription IS NOT NULL
Roy Harvey
Beacon Falls, CT
On Wed, 13 Dec 2006 16:20:40 +0000, Simon Harvey
<nothanks@.hotmail.com> wrote:
>Hi there,
>I need to carry out a database cleaning/maintenance operation whereby I
>take the text in one column called ShortDescription and add it to the
>text in a column called AdditionalDetails.
>I know how to copy from one to the other but that would have the effect
>of overwriting the values in the AdditionalDetails column. I need
>whatever is in the first column to be simply appended to whatever is in
>the second. If the first has null in it, nothing should happen, and I
>guess if the second has a null in it, the null should be replaced with
>whatever's in the second column.
>Can anyone advise me on how to do this? I'm sure it must be a relatively
>simple operation but I've never seen it done.
>Thanks to anyone who can help
>Simon|||You are both SQL Stalions!
I knew it would be simple!
Thank you - you've been a great help
Kindest Regards
Simon
Appending data to an existing record
Use update statement .
eg.
table1 (tablename)
id values
1 text1
2 text2
3 text3
Let the table1 contains two fields id and value. U need to append some text
to the existing values. is it ?
ok...use the following postgresql query .
update table1 set values = values || 'newtext' where id = 1
|| --> string concat operator
This will result in
table1
id values
1 text1newtext
2 text2
3 text3
If you want to update all the rows remove the 'where' condition
Try this and reply
-somaskarthic
Quote:
Originally Posted by srkartes
I am a novice when it comes to using SQL. I would like to append text to existing data in a specified column, but I can not figure out how to do it. I was trying to use an update query, but as far as I can tell this only replaces the data within the column. Any help would be appreciated
Here i mentioned is postgresql query , if u use some other database
please find the appropriate sting concat operator . In postgres || is the concat operator . If you use mysql or sql server , please find the correct concatenation operator.
-somaskarthic
Quote:
Originally Posted by somaskarthic
Hi
Use update statement .
eg.
table1 (tablename)
id values
1 text1
2 text2
3 text3
Let the table1 contains two fields id and value. U need to append some text
to the existing values. is it ?
ok...use the following postgresql query .
update table1 set values = values || 'newtext' where id = 1
|| --> string concat operator
This will result in
table1
id values
1 text1newtext
2 text2
3 text3
If you want to update all the rows remove the 'where' condition
Try this and reply
-somaskarthic
Quote:
Originally Posted by somaskarthic
Hi
Here i mentioned is postgresql query , if u use some other database
please find the appropriate sting concat operator . In postgres || is the concat operator . If you use mysql or sql server , please find the correct concatenation operator.
-somaskarthic
This is the way:
update table1 set values = values + 'newtext' where id = 1|||Thanks guys! Worked perfectly.
appending data to a text column
make some best practice suggestions. Here we go, I am importing data into a
table within my database. I'll use some DDL for clarity.
Create table ImportTable
(ImportId int Not Null,
ImportLog text (10000)
)
Create table ExistingTable
(Existingid int Not Null,
Existinglog text (10000)
)
When the data is imported I would like to check if the ImportId column in
ImportTable has a match in ExistingId column within ExistingTable, is so I
would like to APPEND the data from ImportLog to ExistingLog
This is a shortened version of the actual table but its give you guys a
general feel for what I am trying to accomplish. Thanks in advance for any
assistance.
kw_uh97I think this does the job, you need the where condition if it's possible
to have a null entry in the importlog column, for some reason trying to
append null to existingtext converts it to null too:
update existingtable
set existingtext = existingtext + importlog
from existingtable inner join importtable on existingid = importid
where importlog is not null
*** Sent via Developersdex http://www.examnotes.net ***|||Anthony
Sorry for the delay and thanks for the query it works just fine I will
implement this ASAP.
Thanks, Again
kw_uh97
"Anthony Brown" wrote:
> I think this does the job, you need the where condition if it's possible
> to have a null entry in the importlog column, for some reason trying to
> append null to existingtext converts it to null too:
>
> update existingtable
> set existingtext = existingtext + importlog
> from existingtable inner join importtable on existingid = importid
> where importlog is not null
>
> *** Sent via Developersdex http://www.examnotes.net ***
>
Append to text type field in an update statement.
coulmn with whatever it has with another string. This field may have
more than 8000 characters already
here is What I am trying to do.
Update X
Set textTypeColumn = textTypeColumn + ' XXXXXXXXXXXXXXXXXXXXXXX'
WHERE
id = id
-- some criteria with different joins to different tables.
' XXXXXXXXXXXXXXXXXXXXXXX' will be a fixed string
TextTypeColumn may already have more than 8000 charaters in it and now
I want to append the XXXXXXX string to that and store the new value in
the texttypecolumn. This update statement is inside a stored proc. When
I try to compile it, I am getting below error.
Server: Msg 403, Level 16, State 1, Procedure
stp_scr_postmass_denyopclaims, Line 426
Invalid operator for data type. Operator equals add, type equals text.
I want to avoid cursor and looping for each id and then use Updatetext
to update it.
I would appreciate if you could let me know if it can be done in a
query for all the ids in one go.
Thanks & regards,
MandarText datatype won't support UPDATEs. Check BOL
--
Thanks & Rate the Postings.
-Ravi-
"reachmandar@.gmail.com" wrote:
> I have a table with one text type column. I am trying to append this
> coulmn with whatever it has with another string. This field may have
> more than 8000 characters already
> here is What I am trying to do.
> Update X
> Set textTypeColumn = textTypeColumn + ' XXXXXXXXXXXXXXXXXXXXXXX'
> WHERE
> id = id
> -- some criteria with different joins to different tables.
> ' XXXXXXXXXXXXXXXXXXXXXXX' will be a fixed string
> TextTypeColumn may already have more than 8000 charaters in it and now
> I want to append the XXXXXXX string to that and store the new value in
> the texttypecolumn. This update statement is inside a stored proc. When
> I try to compile it, I am getting below error.
> Server: Msg 403, Level 16, State 1, Procedure
> stp_scr_postmass_denyopclaims, Line 426
> Invalid operator for data type. Operator equals add, type equals text.
> I want to avoid cursor and looping for each id and then use Updatetext
> to update it.
> I would appreciate if you could let me know if it can be done in a
> query for all the ids in one go.
> Thanks & regards,
> Mandar
>