sql

SQL parser in C

I want to parse and store the columns and values of a SQL DML (INSERT, UPDATE, DELETE) statement in C. Need the URL of the open source code or a library with which I can link my C program. The platform is SUSE Linux. Have tried to make and use libSQL unsuccessfully. A detailed answer is appreciated. Thanks. Additional Notes: Please sugg...

How should I write my WHERE clause in SQL Server for the following case?

I have a SQL table with two columns Date and User and contains the following rows: **Date User** 2009-02-20 Danny 2009-02-20 Matthew 2009-02-15 William 2009-02-15 Abner 2009-12-14 Joseph 1900-01-01 Adam 1900-01-01 Eve Given a date, how should I write my WHERE clause to return a list of u...

Dynamic order direction

I writing a SP that accepts as parameters column to sort and direction. I don't want to use dynamic SQL. The problem is with setting the direction parameter. This is the partial code: SET @OrderByColumn = 'AddedDate' SET @OrderDirection=1; . . . ORDER BY CASE WHEN @OrderByColumn='AddedDate' THEN CONVERT(varchar(50),AddedDate)...

OO or procedural

I have an Access db I use for my checkbook (with a good amount of fairly simple VBA behind it) and I'd like to rewrite it as a stand-alone program with a SQL backend. I'm thinking of using either C++, Java, or Python. I had assumed, before I started, that I would write it OO because I thought that I would think "in OO terms" (due to a ...

To run a .sql -file in MySQL

This question is based on this thread. I run unsuccessfully sudo mysql \. /users/cs/SO_db/posts.sql I get the error ERROR 1146 (42S02): Table 'personal.posts' doesn't exist MySQL's manual says A five-character SQLSTATE value ('42S02'). The values are specified by ANSI SQL and ODBC and are more standardized. Not all MySQ...

SQL Query, within php

I currently have a query $query = "SELECT * FROM routes ORDER BY id DESC LIMIT 8;"; And that works all wonderfully. I have table columns id int(10) name varchar(45) base varchar(16) econ int(6) location varchar(12) x int(2) y int(2) galaxy int(2) planet int(2) comm...

JSP result set from MS Access - how to get the location name?

I have a table called "form" in ms access which have following fields: formno, location, status. I want to create a report which calculates: the total no of forms(columns) at each location the total no of forms(columns) with status= "pending" at each location. I tried to do it with this query: select count(formno) as totalforms fro...

T-SQL equivalent of PL/SQL %TYPE?

Is there any equivalent to %TYPE in MSSQL2005? CREATE TABLE TEST (ID NUMBER(5)); DECLARE myVar TEST.ID%TYPE; BEGIN ................ END; ...

Sorting ActiveRecord models by sub-model attributes?

Lets assume I have a model Category which has_many Items. Now, I'd like to present a table of Categories sorted on various attributes of Items. For example, have the category with the highest priced item at the top. Or sort the categories based on their best rated item. Or sort the categories based on the most recent item (i.e., the cate...

Which ASP.NET commands can lead to insecure code?

Personally, I try and write secure ASP.NET code. However, I have become quite paranoid about the code I write, as I used to work for a Registrar (high fraud targets). Are there any ASP.NET functions I should look at with extreme scrutiny (other than SQL access - I know enough not to do dynamic SQL). ...

SQL Server Error!(microsoft sql-dmo odbc sqlstate 42000 )

Hello, I m using SQL Server 2000. I can't backup my database. Its show me a error Message.this is below ... Error Image What is the problem? ...

How do a sql count on an additional table inside a sql stored proc?

I have a stored proc (called sprocGetArticles) which returns a list of articles from the articles table. This stored proc does not have any parameters. Users can leave comments for each article and I store these comments in the comments table linked by the article id. Is there any way I can do a comment count for each articleid in the...

Use Google AppEngine datastore outside of AppEngine project

For my little framework Pyxer I would like to to be able to use the Google AppEngine datastores also outside of AppEngine projects, because I'm now used to this ORM pattern and for little quick hacks this is nice. I can not use Google AppEngine for all of my projects because of its's limitations in file size and number of files. A great...

how do you insert null values into sql server

in sql server enterprise manager, how do you write an insert statement with passing in null values ...

OO program and SQL database

When programming an OO program using a SQL database back-end, do objects' attributes correspond with the rows in the tables? Or more than that? I don't quite understand how objects' attributes relate to data in tables. Thanks for your help. ...

What is the benefit of using "SET XACT_ABORT ON" in a stored procedure?

hi all. What is the benefit of using "SET XACT_ABORT ON" in a stored procedure? ...

Add column2 before column1

Hi, i have table structure with 3 colums (column1, column2, column3) and i want to put another column with sql statement like: alter table tbl_name add column4 but i need to put it between column1 and column2 may i do something like in MYSQL: alter table tbl_name add column4 after column1 ...

First day Of this week and last week

Hi, I am currently getting first day Of this week and last week values with vbscript function in 2/12/2009 format. I was wondering if it was possible with SQL query. ...

OO and SQL

In trying to understand the correlation between program objects and data in tables (here:http://stackoverflow.com/questions/1149877/oo-program-and-sql-database), which I still don't really understand, a strong difference of opinion was revealed over whether it's ok to use a SQL db to store data for an OO program. For a new programmer...

Name of SQL Syntax notation?

Is there a name for a syntax used for SQL? E.g.) When you go to this page on BOL (SQL Books OnLine), it shows the syntax of BEGIN DIALOG CONVERSION BEGIN DIALOG [ CONVERSATION ] @dialog_handle FROM SERVICE initiator_service_name TO SERVICE 'target_service_name' [ , { 'service_broker_guid' | 'CURRENT DATABASE' } ] [ ON CON...