The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
40 views

MySQL distinct string

I have the following sample table. drop table if exists fruit; create table fruit ( id int not null auto_increment primary key, tag varchar(100) not null ); insert into fruit (tag) ...
0
votes
0answers
33 views

MySQL count similar words in strings

I have the following sample table. drop table if exists fruit; create table fruit ( id int not null auto_increment primary key, tag varchar(20) not null ); insert into fruit (tag) ...
1
vote
0answers
13 views

How to generate a random character string of length 8 in Netezza?

I am trying to generate a random character string of length 8 in Netezza, any suggestions?
0
votes
0answers
33 views

Saving String as unique number in Mongo

I have a field in my collection which is a String in nature. When i run aggregation for this field in data it takes considerable time in aggregation. Total 6 million records are in collection which ...
0
votes
1answer
47 views

Does PostgreSQL have a variable character storage layer that optimizes storage space by automatic dedupe?

My application has a Product and a Purchased table. The Purchased table includes a full copy of the Product row at time of purchase, so that, even if a product name or description was changed, the ...
0
votes
1answer
55 views

Filtering the results of a SELECT query to avoid certain words in the value of a column?

I have a table called videos with a column named title and there is a set of words (around 50 words as of now but the number of words may increase) which is the knowledge base for filtering the ...
3
votes
1answer
166 views

Using an index for both asc and desc on a string column

I know a trick to make order by queries faster when we want to order by asc and desc. For integers store a negated value. So if I store -7,-11,-8,-5,-1,-2 the order by asc will give -11, -8, -7, 5, ...
0
votes
0answers
29 views

Order by Like Value and Count

My Name field values are "Name1 (AB)", "Name2 (AB)", "Name3 (CD)", "Name4 (EF)", etc. Is it possible to count the total "%(AB)" and the total "%(CD)" etc...in one query or will it require a sub query? ...
2
votes
3answers
334 views

Removing a string prefix

I have a string of numbers that I need to trim a portion from using TSQL. The string of numbers will always start with 101 then it will have a set of 0s and a set of random numbers. Example: ...
0
votes
0answers
28 views

Storing IDs of strings instead of strings?

I store every visit of a user to our site. In the table describing users (not visits!) I store his device name, device type (desktop, mobile, tablet), device manufacturer, browser name and version, ...
0
votes
1answer
90 views

MYSQL testing string field contains another altered string field

I have this table : mysql> desc mytab; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | ...
3
votes
6answers
40k views

Connect to sql plus from command line using connection string

Let's say I have a Oracle database. I have a username = x, password = y, database = z. Also I know the port = a, SID = b, Hostname = c. So how do I need to connect correctly? I used many options ...
0
votes
1answer
756 views

Split values from field and count them according to another field

I have following MySQL db structure: content ======= id | tags --------- 1 | ,abc,def,ghi, 2 | ,abc,foo, 3 | NULL 4 | ,foo,bar, categories ========== id -- 1 2 categories_to_content ...
0
votes
1answer
661 views

Looping through string, adding all numbers e.g. '123' = 1+2+3, demo with working loop included

This works to output the string 123456 as: 1 2 3 4 5 6 Code: declare @string varchar(20) declare @index int declare @len int declare @char char(1) set @string = '123456' set @index = 1 set @len= ...
0
votes
1answer
2k views

How to convert bytea to text value in postgres?

In my application I insert data in database using C code, since the strings I receive from an untrusted source I have escaped them using PQescapeByteaConn of libpq library. Which is working perfectly ...
1
vote
0answers
139 views

How to use variables in file paths in MySQL statements?

I have now a problem that I have to set paths through variables in queries like load data infile '/my/file/path/to/file.txt' into table database1.table2 fields terminated by '' lines terminated ...
3
votes
1answer
340 views

Splitting different parts of a string

I have an SQL Server database where there is a cell with a delimiter (\) separated string. An example of this string would be: category_path ============= RootCategory\Middle Category\Child ...
1
vote
2answers
249 views

Reason for using hexadecimal in NCHAR()?

I found this in some source code today: SELECT @Error = ERROR_NUMBER (), @ErrorMsg = N'An Error occured while populating the TABLE ' + @DestinationTableName + ...
4
votes
3answers
16k views

T SQL Table Valued Function to Split a Column on commas

I wrote a Table Valued Function in Microsoft SQL Server 2008 to take a comma delimited column in a database to spit out separate rows for each value. Ex: "one,two,three,four" would return a new table ...