The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
38 views

How to separate name string by the spaces in the name in T-SQL

I have a list of names, such as: Doe John James, Doe Jane and Doe Henry Albert Sr I need to split those out into the four component parts of the name (if the name has four parts) to put each of them ...
3
votes
3answers
369 views

T-SQL - How to split (char separated) string into rows and columns

What is the best way to split a char separated string into rows and columns? Here is my input string: !1;100;10;200;0;500;2;1000;30!2;100;3;500;1;2000;5 And here is my desired output table: Id ...
1
vote
0answers
216 views

How do I cast a varchar to Bigint in DB2

I have a field which is varchar(25) and I need to create a join between that field and a field that is a bigint So I guess I need to convert the field into bigint aswell but it's giving me some ...
0
votes
1answer
57 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
76 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
1answer
34 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
101 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
58 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
95 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
364 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
401 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: ...
1
vote
1answer
108 views

MYSQL testing string field contains another altered string field

I have this table : mysql> desc mytab; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | ...
4
votes
6answers
75k 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
863 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
990 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
3k 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
163 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
432 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
283 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
19k 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 ...