sql

how to show complete sql string in kohana orm object?

this is probably trivial, but i have a quite long sql query and echo Kohana::debug( $obj ); cuts off the tail of the query, replacing it with '...'. how would i go about getting the full thing? (something nicer than var_dump if possible ;-)) ...

How to determine of an SQL table row contains values other than NULL

This is the problem: I have a table with unknown number of columns. all the columns are real. Assuming there is only one row in that table, I need a method to determine if there is a value other than NULL in that table/row. I don't know the number of columns nor their name at run-time (and don't want to use c cursor) SQL Server 2005 ...

How to set SQL select in Google SQLDataSourceServlet

Hello I wonder if anyone can help? I'm trying to use part of Google's Visualization API as shown here: Google TableQueryWrapper To get data from a MySQL database table. I have mapped the URL in the .html shown in this example to my application which calls a servlet provided by Google as follows: public class SQLDataSource_Servlet ext...

How to print a customized report in C#

I have a sqldatareader, which contains information that i want to print as a report, in a customized format. how can i do it? Do you think it is good to make an html file, and then print it? if so, how can i print a html file in C#? ...

SQL Server queries case sensitivity

hi I have this database: abcDEF ABCdef abcdef if I write: select * from MyTbl where A='ABCdef' how to get: ABCdef and how to get: abcDEF ABCdef abcdef Thanks in advance forgot to write - sqlCE ...

pivot table row to column

Hi Everyone, I'm using SQLServer2008 Express I have a table and a script to convert the rows into columns with expected result as PARENT_ID name01 name02 name03 name04 1 ABC DEF ABC2 DEF2 2 DEF3 null null null However, I get the result as PARENT_ID name01 name02 name03 ...

How to split compound column like ROW, ARRAY?

I have same problem with this stopped thread. http://www.mail-archive.com/[email protected]/msg28070.html QUERY-1 SELECT r.id, ( SELECT rl.reminder_header, rl.reminder_footer FROM reminder_levels AS rl WHERE rl.lookup = ( SELECT MAX(reminder_level_lookup) ...

How to do a group by/count(*) pr year, month and day in django based on a datetime database field?

I have a table describing files with a datetime field. I want to somehow create a report that gives me the number of files grouped by each year, number of files grouped by each year and month and number of files grouped by each year, month and day. I just want records where count(*) > 0. Preferably using the ORM in django or if that`s no...

Help required with SQLs

Hello, I am trying to join 2 tables and trying to fetch the records, which do not have values in the join column of the 2nd table. For example: Table 1 Id column values: 1, 2, 3, 4, Table 2 Id column values: 1, 3, Given the above example of the values in the join columns of the 2 tables, I want to fetch records from table1 with ids 2 ...

Calculate the number of direct children in a hierarchy

I have a simple hierarchy of categories in an SQLite3 database, each row storing a parent ID or NULL as appropriate. I would like to find out whether a particular category is a leaf, essentially by determining, for each row, whether it has a parent ID defined. Or rather, determining a count of child rows for each row. Table definiti...

In a Sql Bulk Insert statement, can we use relative path(files\a.txt) instead of absolute path(c:\abc\a.txt) or networked universal path (\\abc\a.txt)

I wanted to insert data in a table from a text file where it is stored in csv format to a sql server table. For that, I am using bulk-insert statement. Now I need to specify the file name in "From" clause. I don't want to use networked locations or local locations over there. I want to upload my text file in the same directory as my exec...

SQL Stored Procedure not returning any data

When I run a simple SELECT statement on this table I get a row back (this is correct there should only be one). Here is that SELECT statement: select * from Lending.HMDA where BatchId = 1 Here is the proc I am executing, which returns no rows: DECLARE @BatchStartDate datetime, @BatchEndDate datetime SELECT @BatchStartDate = ...

Automatically Setting a Field Value in SQL

Hello, I have a SQL Server 2008 database with two tables. The first table is called Department. The second table is called Ticket. These two tables are defined as follows: Department ---------- ID Name TotalTickets Ticket ------ ID DepartmentID Description AssignedTo I'm trying to figure out a way to dynamically update the Departmen...

update duplicate or similar records in the same table

I have a table that allows records to be inserted which are very similar but differ by a single column value or two. For example the following records are in the table: ID TITLE URL COUNTRY 1494 Hollywood Reporter http://www.hollywoodreporter.com USA...

SQL: Using Select *

Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc. Is it bad practice to use Select * ? I was going through some old code and saw some 'SELECT *' statements. My previous coworker had told me Select * was bad practice, but I couldn't really see the reason why (unless of course I only ...

How do I return ALL columns in one table and just a few in another using join?

I would rather not have to list all columns in tableA The '*' works for one table, but I don't want to get back all columns in tableB from JOIN. Reason being, these records are being deleted, and I want to store data from tableA (only) as serialized xml for period of time. ...

How Can I Sum Vat in a column in sql server 2008?

Hi all suppose i have the following table CREATE TABLE #ResultTable (NettAmount money, GrossAmount money,TotalVat money) Given a gross amount eg=250 I know that vat is at 17.5% How Do i calculate the totalVat? Thanks for any suggestions ...

SQL selecting from a particular duplicate row

Hi all I have a sql query SELECT FKid1, FKID2, a, b, c from [source] where FKID1 = 3 which returns the following data set so (hope formatting holds) FKID1 FKID2 A B C 3 40297 0 0 2 3 40297 0 100 1 3 40325 0 0 2 3 40325 0 0 3 3 40325 0 10 -1 ...

Find what letters are in a group of records in either SQL or SSRS

I have the following data (I have a lot more rows this is just an example): VALUE Location FLEET REGION P Pocatello, ID 104 232 B Pocatello, ID 104 232 B Spokane, WA 107 232 B Spokane, WA 107 232 In either reporting services or MSSQL I ne...

SSRS - Group_Concat Equivalent using an Expression?

Can I use expressions in Sql Server Reporting services to combine all of the values of a column within a group? I'm trying to accomplish what MySQL's group_concat function does, but in the report (not in the query). Example. I want to make this data: Group 1 Value Test A B Test 2 C D Look this t...