sql

How does MySQL handle WHERE tests?

Hi, As I was coding a php page building a MySQL request according to GET parameters, I was wondering if MySQL does any kind of reorganization of WHERE tests in a request, or if it just takes them as they come. For example, if I execute this request: SELECT * FROM `table` t WHERE (SELECT `some_value` FROM `another_table` u WHERE `t.id`...

TSQL Bulk Insert

Hi all, I have such csv file, fields delimiter is ,. My csv files are very big, and I need to import it to a SQL Server table. The process must be automated, and it is not one time job. So I use Bulk Insert to insert such csv files. But today I received a csvfile that has such row 1,12312312,HOME ,"House, Gregory",P,NULL,NULL,NULL,...

SQL - displaying row where the next numeric value is also available

I have the following query: SELECT CAST(year_week AS NUMERIC) as year_week FROM web_details where location = ''JF'' AND property_id = ''FARM'' which produces the following results. YEAR_WEEK 201035 201036 201037 201039 201041 201044 201045 201048 What I actually want is to produce a set of results which only displays values if the...

SQL Server: procedure don't output anything?

I'm trying to create a stored procedure which will fetch data from sys.databases and sys.database_files and combine this information into a single result set. Here's the code CREATE PROCEDURE dbo.PROC_getDbInfo AS SET NOCOUNT ON GO TRUNCATE TABLE dbo.dbinfo GO EXECUTE sp_msforeachdb 'insert into dbo.dbinfo ...

How many coulmns can exist per table

How many coulmns can exist per table ...

sql select * between exact number of rows.

Hi all, I would like to know if I could using select statement retrieve exact position of the rows. e.g rows between 235 & 250. Is this possible? Thanks in advance, shashi ...

Can select * usage ever be justified?

I've always preached to my developers that SELECT * is evil and should be avoided like the plague. Are there any cases where it can be justified? I'm not talking about COUNT(*) - which most optimizers can figure out. Edit I'm talking about production code. And one great example I saw of this bad practice was a legacy asp application...

error in your SQL syntax - Getting this error and cannot pinpoint where the error is

I am building a search function on my website and I am having some trouble locating an error in the SQL. There are four SQL statements used to return the counts of the same search using the AND and the OR keywords. The second set of SQL statements return the actual results of the AND and the OR searches limited according to the page numb...

joining two tables with differnt join column names

I have two tables A -> B with many-to-one mapping/associations. Table B's primary key is foreign key in table A. The problem is column names in both tables are different. let's say B has primary key column "typeNumId" which is foreign key in table A as "type". How can I join both tables on this column? how can I specify mapping to ind...

IF statement in Propel select criteria

Hi everyone, I am trying to incorporate an IF statement into my propel criteria. This is the how I build up my criteria: $c = is_object($c) ? $c : new Criteria(); $c->addSelectColumn("CONCAT(DAYOFYEAR(" . SomePeer::CREATED_AT . "), ' ', YEAR(" . SomePeer::CREATED_AT . ")) AS period"); $c->addSelectColumn("COUNT(" . SomePeer::ID . ") AS...

Is an extent used to add new data?

Is an extent used to add new data?what is segment and how is it releted to an extent? ...

Excel Stored Procedure with Excel

I have stored proc Im pulling in to excel but to get it to Run I have to enter my text exec roc 'Name' I need it to be able to have someone else thats running it be able to enter a name as they refresh the data. I dont know VBA at all and am looking for help. ...

Getting "The column name xxx is not valid" exception when trying to combine columns

I am trying to combine two columns in SQL query but getting the following exception in java.sql.ResultSet's FindColumn method: JdbcSqlException: The column name FullName is not valid. Column: 'FullName' Here is my SQL query SELECT U.FirstName + ' ' + U.LastName AS FullName FROM User as U Anyone? Please note that query runs ...

Making a more efficient join

Here's my query, it is fairly straightforward: SELECT INVOICE_ITEMS.II_IVNUM, INVOICE_ITEMS.IIQSHP FROM INVOICE_ITEMS LEFT JOIN INVOICES ON INVOICES.INNUM = INVOICE_ITEMS.II_INNUM WHERE INVOICES.IN_DATE BETWEEN '2010-08-29' AND '2010-08-30' ; I have very limited knowledge of SQL, but I'm trying to understand s...

SQL View Question

Are there any negative affects of creating Views, specifically large ones (50+ columns) on the database? ...

Is there any framework for parsing a SQL-like query into its component parts?

I'm interested in writing a SQL-like query syntax for a CMS I work with. The idea would be that a CMS query could be written in a SQL-ish syntax, and I would convert that to execute through the CMS API. There would be no field or table selection, so I need some way to get from this: SELECT WHERE Something = 'something' AND (SomethingE...

Parse/deconstruct SQL with VBA-Access

Does anyone know of a way to deconstruct a SQL statement (take a select SQL statement, extract columns from each SELECT, tables from each FOR and each JOIN, and filtering criteria from each WHERE. I can then put this data into a BOM table to create a "map" of the query), including subqueries, using VBA? I have a project to map Teradata v...

What's your favorite SQL 2005 and SQL 2008 book?

Possible Duplicate: Best Book for a new Database Developer I'm looking to become an intermediate, eventually advance sql programmer. I'm currently half way between beginner and intermediate. I'd like to book to cover at least beginner to intermediate, or all the way even. Thanks Thank you all for your responses, I have chos...

Trying to make a query that takes two tables into account

I am looking for some guidance. I am trying to select the following From tbl_leaguetables i want to select user, team, league league is connected to tbl_leagues ie if league = 15, in tbl_leagues, the id will be 15. in that table i then want to get game, type, name but only where the format = "yes" How can this be done? I really do...

ReportingService2005 API

How i can get list of parameters from report using ReportingService2005 API? ...