Run Column Text Query
Apr 7, 2014How to run a query that is in the column as text?
View 2 RepliesHow to run a query that is in the column as text?
View 2 RepliesSandip writes "I am doing a Project for detection of advertisement in a Web page.
For that I have used one column called ImageText
For giving Training to my database I stored (say) 100000 records in ImageText
Now I want to First n Sequence of Text Which Comes Most Times
For Exa:
ImageText
---------
ABc
ABcd
ABABABABAB
ABcdxyAB
ABcdABcdABcdcdAB
Here,
String No Of Times String Occurs
------ ---------------
AB 13
cd 6
ABc 6
ABcd 3
cdA 3
.....
....
ABc 1
ABcd 1
ABABABABAB 1
ABcdxyAB 1
ABcdABcdABcdcdAB 1
That is i want to find within a string also
For First 3 Most Popular Sequences
Output
------
AB
cd
ABc
Please Reply
If you do not understand the question
then
send me mail"
Hi All
I am working on a query to get all the datetime values in a column in a table into a comma separated text.
eg.
ColumnDate --------------------------- 2005-11-09 00:00:00.0002005-11-13 00:00:00.0002005-11-14 00:00:00.0002005-11-16 00:00:00.000
I wanted to get something like
2005-11-09, 2005-11-13, 2005-11-14, 2005-11-16
Have just started SQL and hence am getting confused in what I think should be a relatively simple query. Any help will be much appreciated. Thanks
I am looking to filter the query using the free text predicate Contains for one of the column that have dimensions of the items. The query is something like
Select * from sampletable
where contains(filtercolumn, 'Near("*cm , *cm , *cm , *Kg.",10,True)')
Data in the filtercolumn is something like 64cm x 25cm x 35cm = 10Kg.
The query do not return any data.I also tried running the below query to see if cm* can be searcher for, but with no result again
Select * from sampletable
where contains(filtercolumn,, '"cm*"')
If I do something like below, it does return all columns that have 35cm within the text.
Select * from sampletable
where contains(filtercolumn,, '"35cm"')
Hi everyone,I encountered an error "Need to run the object to perform this operationCode execution exception: EXCEPTION_ACCESS_VIOLATION" When I try to import data from Oracle to MS SQL Server with EnterpriseManager (version 8.0) using DTS Import/Export Wizard. There are 508 rowsin Oracle table and I did get first 42 rows imported to SQL Server.Anyone knows what does the above error message mean and what causes therest of the row failed importing?Thanks very much in advance!Rene Z.--Posted via http://dbforums.com
View 1 Replies View RelatedI have a parameter value as shown below and this is dynamic and can growÂ
Example : 101-NY, 102-CA, 165-GA
116-NY, 258-NJ, 254-PA, 245-DC, 298-AL
How do I get the values in the below format
NY,CA,GA Â --- each state to be followed with comma and the next state
NY,NJ,PA,DC,AL Â --- each state to be followed with comma and the next state
correct query that will fetch  only state names and not the numbers.
Hi,
I have a table with col_noteText defined as 'Text' datatype column.
I want to search a pattern 'Lawyer' and replace with 'Attorney' in the column col_noteText.
Does anyone know how to do this for 'Text' datatype column.
Thanks in advance.
jfk
Hi,
I am mapping the .csv files to a destination table in sql server.
The names of each column in the .csv file is the same as the ones in the destination table.
In the destination table there is an extra field i.e. FileTypeField
Here is the question;
When transfering the data from .csv to the destination table i.e flat file source to oledb destination, I would like to place a text into the field FileTypeField
I do not see an option to do this. Can you help please?
Thanks
HiI have to create an XML file based on a SQL SERVER 2005 table.Everything works fine:SELECT 1 as Tag,
NULL as Parent,
Ex_Id as [Exam!1!Ex_Id],
NULL as [Ex_Title!2!!cdata]
FROM Exams
WHERE ex_State = 'P'
UNION ALL
SELECT 2 as Tag,
1 as Parent,
Ex_Id,
ex_Title
FROM Exams
WHERE ex_State = 'P'
order by [Exam!1!Ex_Id], [Ex_Title!2!!cdata]
FOR XML EXPLICIT, ROOT('Exams')
BUT when i add another column, a text column, I get into trouble: SELECT 1 as Tag,
NULL as Parent,
Ex_Id as [Exam!1!Ex_Id],
NULL as [Ex_Title!2!!cdata],
NULL as [Ex_Situation!3!!cdata]
FROM Exams
WHERE ex_State = 'P'
UNION ALL
SELECT 2 as Tag,
1 as Parent,
Ex_Id,
ex_Title,
ex_Situation
FROM Exams
WHERE ex_State = 'P'
order by [Exam!1!Ex_Id], [Ex_Title!2!!cdata], [Ex_Situation!3!!cdata]
FOR XML EXPLICIT, ROOT('Exams')
The problem is clearly the fact that i have to sort on the text column, plus the fact that this column requires the CDATA tag enclosurePlease help me....i'm desperate :(
Hi:
I wanna write text in a sql column of type nvarchar, this text is of type Query, Do you understand me?
Mi problem is that when I write this:
SELECT * FROM SCAT WHERE SC_ID = 'froog'
The simple comillas, they cause an error in my command of insert.
How can I write this type of text in a colum SQL?
Hi
I had a text type not null column which i wanted to change to a null column.Writing a simple alter statement gave me an eror cannot change text type column so i tried to rename the original column create a new column with the same name and allowing nulls on it and then copying the contents of the renamed column to the new column and finally deleting the renamed column.
EXEC sp_rename 'TableName.ColumnName', 'ColumnName_old', 'COLUMN'ALTER TABLE TableName ADD ColumnName text NULLUPDATE TableName SET ColumnName = ColumnName_oldALTER TABLE TableName DROP COLUMN ColumnName_old
However when i tried to execute these statements in query analyser on the Update statement it gave me the error that ColumnName_old does not exist.
However then I tried to execute these queries one by one I was able to do that.
Can anybody tell me whats causing the queries to not be executed all at once without giving the ColumnName_old does not exist error cause I wanted to run them on live dbs.
any help would be appreciated.
Himani
how can i update a column with datatype of text with a combination of columns having a datatype of float? do i convert the float columns to varchar/char/?? and/or can i convert the column i am updating?
thanks!
Hi All ,
Is it possible to insert the below text into a column and retrieve it in the same format ?
Thanks,
Hari Haran Arulmozhi
TEXT :
CLIENT NAME : ABC Corporation
CLIENT CITY : MUMBAI
================================================
INV_NO INV_DATE INV_AMT
================================================
I100 01-01-2006 Rs.600
I200 01-02-2006 Rs.800
I300 01-03-2006 Rs.1600
I400 01-04-2006 Rs.2600
I500 01-05-2006 Rs.9600
RECEIVED ADVANCE :Rs.10000
I have a column named DATEID in a table DATA that contains the
following format connected to each other(date and name):
20071030Jones
20071020Smith
20070918Rogers
20080122Williams
etc..
What would the syntax be to insert a column to the right of this one,
and extract the first 8 digits from the data in the DATEID column and
insert that into the new column DATE, therefore making it easier for
me to query against an actual date?
Thanks
Hi all
i want to remove text from my column name using query.
for example
i have the product name like "silver 8' trampoline pack "
i need to remove "silver 8' " and want to display only trampoline pack
similarly if I have product name like "gold 8' trampoline pack"
i need to display only trampoline pack.
can anybody help me in this regard?
thanks
Hello,If I create a table with two columns of type "Text" will that cause anyissues? If my memory serves me correctly I thought I read a while backthat is it standard practice to only have one "Text" column per table.Any input would be appreciated.Thanks,Rob Panosh
View 2 Replies View RelatedHi,
I have a table with a TEXT column and this column contains an XML document. I'm developing a TSQL stored procedure which reads the content of this column and accesses the values in the XML elements but I have a lot of problems...
1) How can I read the text column and store the value in a variable? I tried
declare @a varchar(2048)
set @a = (SELECT TEXT_COLUMN FROM MY_TABLE)
but it returns
Server: Msg 279, Level 16, State 3, Line 2
The text, ntext, and image data types are invalid in this subquery or aggregate expression.
I tried also with the READTEXT function but I just can't find how to store data read in a variable...
2) which length should I use for the VARCHAR variable which will store the data? Is it possible not to specify a length with SQL Server 7 or 2000?
Thanks!
Andrea
I need to setup repliaction between A and B. I have high transaction /min count. Some tables have TEXT columns. This is what i am planning to do:
Example: table name is CREDITS
vertical partition the table into two. First table (will be called CREDITS_PRI) holds PK column and non TEXT columns, second table (will be called CREDITS_SEC) holds PK column and TEXT columns.
Create a view called CREDITS with INSTEAD OF triggers for inserts, updates and deletes. So far so good. Then setup replication with immediate updating subscription between A and B for tables called ..._PRI and merge replication between A and B for tables called ..._SEC.
Would this work? How do other companies handle this? thank you in advance for pointing me into the right direction.
Lars
I'm trying to store a binary data file in my database. I've tried data types image, varchar(max) and text. I don't get error message on loading the data but as soon as the text file exceeds 32,000 bits a query returns an empty data set.
Is this a SSMS display problem and the data is really there? Or is this another one of Microsoft's memory bugs?
Hi!
Can anyone help me by telling how to migrate data having text datatype.
i wrote a proc to select data from source
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spAP_PS_VENDOR_CONVER]
AS
SET NOCOUNT ON
SELECT UPPER(SETID) AS SETID
,UPPER(VENDOR_ID)AS VENDOR_ID
,CONVER_DT
,CONVER_SEQ_NUM
,CNTCT_SEQ_NUM
,UPPER(CONVER_TOPIC) AS CONVER_TOPIC
,UPPER(OPRID)AS OPRID
,REVIEW_DAYS
,REVIEW_DATE
,REVIEW_NEXT_DATE
,UPPER(KEYWORD1) AS KEYWORD1
,UPPER(KEYWORD2) AS KEYWORD2
,UPPER(KEYWORD3) AS KEYWORD3
,CAST(ISNULL(DESCRLONG,'') AS VARCHAR(200)) AS DESCRLONG
,PROCESS_INSTANCE
,MAX(EY_SF_UPDATE_DTTM) AS EY_SF_UPDATE_DTTM
,PROCESS_DTTM
,CREATED_DTTM
,UPPER(EY_SF_ACTN_FLG) AS EY_SF_ACTN_FLG
,UPPER(EY_SF_STATUS) AS EY_SF_STATUS
FROM Metastorm.dbo.AP_PS_VENDOR_CONVER
WHERE EY_SF_STATUS='N'
GROUP BY SETID,VENDOR_ID,CONVER_DT,CONVER_SEQ_NUM,CNTCT_SEQ_NUM,CONVER_TOPIC,OPRID
,REVIEW_DAYS,REVIEW_DATE,REVIEW_NEXT_DATE,KEYWORD1,KEYWORD2,KEYWORD3,DESCRLONG
,PROCESS_INSTANCE,PROCESS_DTTM,CREATED_DTTM,EY_SF_ACTN_FLG
,EY_SF_STATUS
SET NOCOUNT OFF
iam getting the following error.
Msg 306, Level 16, State 2, Procedure spAP_PS_VENDOR_CONVER, Line 4
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Here DESCRLONG is a text column.
Pls help me to resolve this.
Regards,
sg
Hi,Suppose I have a table containing monthly sales figures from my shopbranches:Branch Month Sales-----------------------London Jan 5000London Feb 4500London Mar 5200Cardiff Jan 2900Cardiff Feb 4100Cardiff Mar 3500The question I am trying to ask is this: in which month did each branchachieve its highest sales? So I want a result set something like this:Branch Month----------------London MarCardiff FebI can do a "SELECT Branch, MAX(Sales) FROM MonthlySales GROUP BY Branch" totell me what the highest monthly sales figure was, but I just can't figureout how to write a query to tell me which month corresponded to MAX(Sales).Ideas anyone?Cheers,....Andy
View 5 Replies View RelatedHi,How do we use like when we have a column of type TextSelect * from where myColumn LIKE 'prefix%'where myColumn is of type Text in SQL server 2005Thanks.
View 1 Replies View Relatedhi
i have a table with a column which contains a large paragraph of data.
i need to search for a pattern within this text and update it.
for example the column contains 4096 char.
within this text, i search for a pattern"qwerty" and convert it to "asdfgh".
any ideas how this can be done?
i'm using sql server 2000
i have to write something like
UPDATE [DB].[dbo].[Table] SET [Column1] = '.............', WHERE ..........
any help will be appreciated.
I m using SQL Server 2000.
I have Tabel named Topic and have a column name lineage. lineage has data like following:
//////546707//546707//546707/43213/
Now I want to get records who has only one "/" in it's crreponding lineage column.
Can somone tell me how to do that in SQL Server 2000?
Thanks
Khushbu
Hi Everyone,
I have a simple webform with a text box with multiline enabled and a submit button, in vb.net. Inside the text box, when you are typing text with let's say adding carriage returns, spaces etc. How to i save the text to a database? By that, i mean, how to i declare the column in my database, varchar, text ...?
Also, when retrieving the saved text back to the textbox, will it keep the formatting because that's what i am trying to do? Or, what is the best way to keep text formatting in a database?
Thanks for the help,
Kevin
I have a table and in one column is a html file. I need to to be able query some text that is inside this html file.
What is the best way to take this html file and add the text of the document into another column in the same table?
Palm
Hi DBAs,
I am very new in SQL server. I created a table where one column is varchar(8000). But when I am trying to insert value from enterprise manager this column cann't accept a long text value. I counted that its' capacity is 1012 charecters. I have tried a lot but don't know how to solve this. I really need help from you. Pls help.
Thanks in advance
Rajat Raychaudhuri
Hi gurus
A developer created a stored procedure that search in a huge table in a column with ‘like’ statement.
I know that the best solution in most case is use of full-text.
But the content of this specific column is a XML data and Full-text don´t find words as desired.
For example:
Table content:
ID = 1
DsColumn = ´<Name>BETH</Name>´
select * from tbResp
where DsColumn like '%BETH %'
Results:
IDDsColumn
--- ---------------------------------
1<Name>BETH</Name>
1 row(s) affected
select * from tbResp
where
contains(DsColumn, ' BETH ')
0 row(s) affected
Can anyone give me a better solution?
tks
I have the following time value column in a table:
next_run_time
230000
73000
70000
The above actually translates to 23:00, 7:00AM,7:30AM, etc. How can I convert this into a meaningful time value?
[CODE]
SELECT NEXT_RUN_TIME FROM TABLE T1
[CODE]
Hi,
How do we use like when we have a column of type Text
Select * from where myColumn LIKE 'prefix%'
where myColumn is of type Text in SQL server 2005
Thanks.
__________________
Hello. I using a simply SELECT statement to retrieve some data from aSQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXTbecause the amount of data. Anyway, my SQL statements worked just finewhen I was using VARCHAR, but now since I am using TEXT, I am onlyreceiving part of the content back. Do I have to do some sort ofspecial Casting or something if I want to get all the content back?It's over 8,000 characters. Thank you very much. I have racking mybrain on this for a while.
View 8 Replies View RelatedHi Everyone, I´m new to this group, I´m trying to write a text filesadding content from a text column (more than 8000 characters), I foundcode how to write files and it works but i have the problem when addedthe text column to the body of the file.any idea? tip? thanks in advance! Pablo.
View 1 Replies View RelatedHi All,We're running SQL Server 2000, SP3.I have a stored procedure that consists of a single Select statement.It selects a bunch of columns one of which is a column of data typeTEXT.SP takes 30 sec to run which causes timeouts on the Front End.When I comment out the Text column from the select it only takes 1Sec.Is there anything I can do about it? I know I can't index a Textcolumn. It's also not used in the where clause, so no need forFull-Text Search.But we absolutely have to have it in the Select clause.Thanks for the help in advance.~Narine
View 5 Replies View Related