I need to write some data to SQL Server database from Linux in C++.
I found this sqlapi.com
But I think, at first ODBC driver has to be installed and has to work.
I folowed this
adminlife.net/allgemein/mssql-zugriff-unter-debian-etch-mit-unixodbc-und-freetds/
or this
http://b.gil.megiteam.pl/2009/11/linux-odbc-to-mssql/
But it didn't...
I have a table that stores RDF triples:
triples(triple_id, sub_id, pre_id, obj_id)
The method (I need to write) will receive an array of numbers which correspond to pre_id values. I want to select all sub_id values that have a corresponding pre_id for all the pre_ids in the array that is passed in.
E.g. if I had a single pre_id values...
I have an old database and a new database. The old records were converted to the new database recently. All our old applications continue to point to the old database, but the new applications point to the new database.
Currently the old database is the only one being updated, so throughout the day the new database becomes out of sync...
I need to average some values in a row-wise fashion, rather than a column-wise fashion. (If I were doing a column-wise average, I could just use avg()). My specific application of this requires me ignore NULLs in averaging. It's pretty straightforward logic, but seems awfully difficult to do in SQL. Is there an elegant way of doing m...
Hello
Since i'm a poor sql developer, i need support to write a sql query for the following scenario (just a simplified example of my situation):
i've got 3 tables, say employe table,department table and companybranch table.
the dept column , on the employe table is a fk on the department table; the branch column on the department table...
Working with cursors in mysql-python I used to call "BEGIN;", "COMMIT;", and "ROLLBACK;" explicitly as follows:
try:
cursor.execute("BEGIN;")
# some statements
cursor.execute("COMMIT;")
except:
cursor.execute("ROLLBACK;")
then, I found out that the underlying connection object has the corresponding methods:
try:
c...
In SQL server,How can i place the value of more than one column in variables using one query
Ex : My query is :
SELECT ET.ID,ET.Description,ET.DefaultTemplateText
FROM TBL_EMAILTEMPLATE ET
WHERE ET.NAME='OneWeekReminder'
I want to place the Column values in variables.
Thanks in advance for the help
...
I'm trying to optimize up some horrendously complicated SQL queries because it takes too long to finish.
In my queries, I have dynamically created SQL statements with lots of the same functions, so I created a temporary table where each function is only called once instead of many, many times - this cut my execution time by 3/4.
So my ...
I have two tables like the ones below. I need to find what exchangeRate was in effect at the dateOfPurchase. I've tried some correlated sub queries, but I'm having difficulty getting the correlated record to be used in the sub queries.
I expect a solution will need to follow this basic outline:
SELECT only the exchangeRates for the ...
I have a table where we record per user values like money_spent, money_spent_on_candy and the date.
So the columns in this table (let's call it MoneyTable) would be:
UserId
Money_Spent
Money_Spent_On_Candy
Date
My goal is to SUM the total amount of money_spent -- but only for those users where they have spent more than 10% of their...
I have this stored procedure:
CREATE OR REPLACE PROCEDURE "LIQUIDACION_OBTENER" (
p_Cuenta IN NUMBER,
p_Fecha IN DATE,
p_Detalle OUT LIQUIDACION.FILADETALLE%TYPE
) IS
BEGIN
SELECT FILADETALLE
INTO p_Detalle
FROM Liquidacion
WHERE (FILACUENTA = p_Cuenta)
AND (FILAFECHA = p_Fecha);
END;
/
...and my c# code:
...
How can you find out what transaction log backup files have been restored using SQL in SQL Server 2005?
...
When using this SQL query:
"Select * from table_name"
what happens if the name of the table contains blankspaces? Is there an special SQL sintax for selecting a table with a name such as "Author Code"?
...
I have a need to execute DBCC SHRINKFILE for multiple db's within the same sproc.
I could create multiple sprocs so it runs within the given context, but I was curious if there were alternatives?
...
I have a query that I am executing in C# that is taking way too much time:
string Query = "SELECT COUNT(HISTORYID) FROM HISTORY WHERE YEAR(CREATEDATE) = YEAR(GETDATE()) ";
Query += "AND MONTH(CREATEDATE) = MONTH(GETDATE()) AND DAY(CREATEDATE) = DAY(GETDATE()) AND USERID = '" + EmployeeID + "' ";
Query += "AND TYPE = '5'";
I then use S...
I'm noticing something a bit unexpected with how SQL Server (SQL Server 2008 in this case) treats correlated subqueries within a select statement. My assumption was that a query plan should not be affected by the mere order in which subqueries (or columns, for that matter) are written within the projection clause of the select statement...
I would like to do something like this i.e., use wild card characters in the in clause:
SELECT * FROM mytable WHERE keywords IN ('%test%', '%testing%')
This is not supported in SQL Server.... Is there some other way to achieve it...
Looking for something other than:
SELECT * FROM mytable WHERE keywords like '%test%' or keywords like...
I have a database table that has a column of type money, allowing nulls. Using a SqlDataReader named reader, I can do
decimal d = reader.GetDecimal(1);
which works, unless of course we're reading a null. If I try using SqlDecimal instead--and I thought the whole point of the SqlTypes was to deal with nulls--then I get an invalid cast,...
OK, so I have two tables I'm working with - project and service, simplified thus:
project
-------
id PK
name str
service
-------
project_id FK for project
time_start int (timestamp)
time_stop int (timestamp)
One-to-Many relationship.
Now, I want to return (preferably with one query) a list of an arbitrary number of projects, sorted ...
hi everyone
myRs=myStmt.executeQuery("select i_col,col_name from tab_col")
i=0
while (myRs.next()):
list= myRs.getString("I_COL")+','+myRs.getString("COL_NAME")
i have a jython code to run a sql statement i want to store all the row of the sql into a single variable. I used to list to store the value but its always storing only t...