sql

Report Builder 2.0 : How to get the correct timezone info.

I am developing report using SQL Report Builder 2.0, In this I am passing the timezone offset value as a parameter (-04:00). Using "TimeZoneInfo" I am getting all the timezones available from the system. But I am checking the timezone with the offset value, so from the list available I can only get the first timezone object. Is there an...

Cassandra Production ready on Windows?

Question anyone know of any success stories of Cassandra running on windows in a production environment? I'm doing some work on Cassandra and trying to find the correct platform for it currently the platform is windows running MS-SQLas the data store. what are the dis-advantages if any when running Cassandra on a windows environment. ...

Basic join query understanding

I know this very silly, but can anybody help me in understanding what does this join query is doing in elabortive description? SELECT j1.* FROM jos_audittrail j1 LEFT OUTER JOIN jos_audittrail j2 ON (j1.trackid = j2.trackid AND j1.field = j2.field AND j1.changedone < j2.changedone) WHERE j1.operation = 'UPDATE' AND j1.trackid=$t_id...

Date format in SQLite - iphone - How ?

I know that - SQLite doesn't support Day name & month name. I have gone through this question. I have created two custom functions for it. My custom function for Converting Day name from day number ( %w day of week 0-6 with sunday==0 ) +(NSString*)dayNameStringFromDayNo:(NSString*)dayNo{ return ([dayNo isEqualToString:@"0"])?...

How to concatenate all the records in a column returned by a query into one varchar string in T-SQL?

A query (SELECT/FUNCTION/VIEW/PROCEDURE) returns a column of varchar records. I need to concatenate them all into one single varchar line. How do I best do it in T-SQL? ...

where condition depending on parameter

Hi. I'm a sql newbie, I use mssql2005 I like to do select with the condition which is depending on the input parameter I've tried this. WHERE CF.PROCESS_DATE = '2010-05-05' AND CASE @CATEGORY_LEVEL WHEN 'L' THEN CAS.MCATEGORY_ID = '' AND CAS.SCATEGORY_ID = '' WHEN 'M' THEN CAS.SCATEGORY_ID = '' END but didn't work and ha...

Active Record/ORM vs Normal Forms?

Hello, I've been playing around with Active Record a bit, and I have noticed that A.C./ORM always uses the following database model when creating a one-to-one relationship Person id | country_id | name | ... Country id | tld | name | ... No I wondered, isn't this a violiation of the third Normal Form? This clearly states "...

SQL SELECT with time range

Hi, I have below click_log table logging hits for some urls site ip ua direction hit_time ----------------------------------------------------- 1 127.0.0.1 1 20010/01/01 00:00:00 2 127.0.0.1 1 20010/01/01 00:01:00 3 127.0.0.1 0 20010/01/01 00:10:00 .... ......... ...

PHP: BBCode with SQL selection?

I would like to code a bbcode with SQL selection. Basically I want the user to be able to input [user]Anotheruser[/user] in a text field, which then is converted in the front-end to an URL that looks like this: http://mydomain.com/user/[userid]/anotheruser. So in order to get the userid, I'd need to include an SQL selection, and addition...

Accessing Oracle 6i and 9i/10g Databases using C#

Hi all, I am making two build files using NAnt. The first aims to automatically compile Oracle 6i forms and reports and the second aims to compile Oracle 9i/10g forms and reports. Within the NAnt task is a C# script which prompts the developer for database credentials (username, password, database) in order to compile the forms and repo...

symfony get data from array

Hi, I'm trying to use an SQL query to get data from my database into the template of a symfony project. my query: SQL: SELECT l.loc_id AS l__loc_id, l.naam AS l__naam, l.straat AS l__straat, l.huisnummer AS l__huisnummer, l.plaats AS l__plaats, l.postcode AS l__postcode, l.telefoon AS l__telefoon, l.opmerking AS l__opmerking, o.org_i...

How to return table name from stored procedure in dataset.

I used a dataset to store 15 tables that I need at the time of loading. When i filled all the tables using stored procedure it returns me all the table but name of the table doesn't comes as that of actual table name in a database. It takes all the table with table name as Table1, Table2, Table3... I want them to be with the name as t...

How do I modify the hundards of records based on my query result?

Hi, I inserted some error record to my table, I can query via the sql below and found hundards of record marked with half. SELECT * FROM `marathon` WHERE gender = 'male' && distance = 'half'; How to write a SQL then I can modify the result rows distance from 'half' to 'full'. Thank you. ...

SQL GROUP BY with "default values"

I'm trying to create SELECT statement with a GROUP BY clause, which should return "default values". Imagine the following simple MySQL table: CREATE TABLE `tracker` ( `id` INTEGER PRIMARY KEY auto_increment, `date` DATETIME NOT NULL, `customer_id` INTEGER NOT NULL ); The table contains only one record: INSERT INTO `tracker` (`...

Data type mismatch in criteira expression

I'm getting this error: Data type mismatch in criteira expression when trying to execute this query in access: select sum(total_sum) from totals_table where tot_date >= '3/01/2010' and tot_date < '4/01/2010' P.S. tot_date is of type Date/Time and tot_sum is of type Number ...

How do I format a date column in MySQL?

My query returns the row value as "2/27/2010 12:00:00 AM" but I need to get "2/27/2010". What do I use to get the format as I need it for MySQL? ...

How to display SUM fields from a detailed table in a master table

What is the best approach to display the summery of DETAILED.Fields in its master table? E.g. I have a master table called 'BILL' with all the bill related data and a detailed table ('BILL_DETAIL') with the bill detailed related data, like NAME, PRICE, TAX, ... Now I want to list all BILLS, without the details, but with the sum of the P...

Changing a SUM returned NULL to zero

I have a Stored Procedure as follows: CREATE PROC [dbo].[Incidents] (@SiteName varchar(200)) AS SELECT ( SELECT SUM(i.Logged) FROM tbl_Sites s INNER JOIN tbl_Incidents i ON s.Location = i.Location WHERE s.Sites = @SiteName AND i.[month] = DATEADD(mm, DATEDIFF(mm, 0, GetDate()) -1,0) GROUP BY s.Site...

'dynamic' SQL join possible?

Hi, I have a table Action with a (part of the) structure like this: Action: ActionTypeID, ActionConnectionID ... ActionTypeID refers to types 1-5 which correspond to different tables (1=Pro, 2=Project etc.) ActionConnectionID is the primaryKey in the corresponding table; ie. ActionTypeID=1, ActionConnectionID=43 -> would point...

How can I do this with LINQ?

All I'm after doing is this: SELECT CallTypeID, Count(CallTypeID) as NumberOfCalls FROM [Helpdesk_HR].[dbo].[CallHeader] WHERE CallHeader.DateOpened <= GETDATE()-7 GROUP BY CallTypeID in LINQ. But I can't work out a way of doing it and getting it to work. I would use Linqer, but my company won't pay for it at present. Any help is gre...