The string tag has no wiki summary.
0
votes
0answers
8 views
How to Improve mySQL Function
I have a Stored Function and I would like to know if this can be improved by anyone better than me. (i'm 2 weeks in Stored Procedures)
This accepts a DELIMITER and a string to "clean up".
The idea is ...
0
votes
1answer
101 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
153 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
88 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
774 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
94 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
186 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
123 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
8k 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 ...