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…
Tag: sql
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. Ans…
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_fke…
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 possibl…
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?
Simulating group_concat MySQL function in Microsoft SQL Server 2005?
I’m trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that’s life). In the original app, we used almost entirely ANSI-SQL compliant statements, with one …
SQL Server 2005: Determine datatype of variable
Is it possible to determine the type of a local variable at runtime in TSQL? For example, say I wanted to do something along these lines: Or Does anyone know of any way to accomplish this? EDIT: This is not for a specific task, this is more of a general knowledge question. I do appreciate answers that indicat…
Is a view faster than a simple query?
Is a faster than the query itself to create the view (in order to have the same resultSet): ? It’s not totally clear to me if the view uses some sort of caching making it faster compared to a simple query. Answer Yes, views can have a clustered index assigned and, when they do, they’ll store tempo…