Is it possible to get a query string from a PDO object with bound parameters without executing it first? I have code similar to the following (where $dbc is the PDO object): Currently, this will echo out a SQL statement like: “SELECT * FROM users WHERE username = ?”. However, I would like to have the bound parameter included so
How to convert java.util.Date to java.sql.Date?
I am trying to use a java.util.Date as input and then creating a query with it – so I need a java.sql.Date. I was surprised to find that it couldn’t do the conversion implicitly or explicitly – but I don’t even know how I would do this, as the Java API is still fairly new to me. Answer tl;dr How
Drop all tables command
What is the command to drop all tables in SQLite? Similarly I’d like to drop all indexes. Answer
Is there efficient SQL to query a portion of a large table
The typical way of selecting data is: select * from my_table But what if the table contains 10 million records and you only want records 300,010 to 300,020 Is there a way to create a SQL statement …
Passing multiple values for a single parameter in Reporting Services
I have several Multi-Select parameters in my report. I am trying to find a way to pass in multiple values for a single parameter in the web query string? If I pass in a single value, it works fine. The report runs fine selecting multiple choices for a single param. My trouble lies in the web query string. Answer Although
MySQL Query GROUP BY day / month / year
Is it possible to make a simple query to count how many records I have in a determined period of time like a year, month, or day, having a TIMESTAMP field, like: SELECT COUNT(id) FROM stats WHERE …
How can I list all foreign keys referencing a given table in SQL Server?
I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers preferable over clicking about in the GUI of the management studio.) Answer Not sure why no one suggested but I use sp_fkeys
Is it possible to execute a stored procedure over a set without using a cursor?
I would like to execute a stored procedure over each row in a set without using a cursor with something like this: SELECT EXEC dbo.Sproc @Param1 = Table1.id FROM Table1 I am using T-SQL in SQL Server 2005. I think this might be possible using a function, but I’d like to use a stored procedure if possible (company standards) Answer
SQL Server – where is “sys.functions”?
SQL Server 2005 has great sys.XXX views on the system catalog which I use frequently. What stumbles me is this: why is there a sys.procedures view to see info about your stored procedures, but there …
There are a method to paging using ANSI SQL only?
I know: Firebird: FIRST and SKIP; MySQL: LIMIT; SQL Server: ROW_NUMBER(); Does someone knows a SQL ANSI way to perform result paging?