sql

SQL Full-Text-Search returns no results when any noise words are in search string.

I have an asp.net web page used to search for company names in our database using FTS. They enter the company name in a search box and submit. First I trim any leading or trailing spaces, then i replace each internal space with " NEAR ". So a search for: "The Association of Lefthanded Picklepickers" Is fed as: "The NEAR Associ...

Order By, Group By - Problems

Ok, so here's the issue. Currently I'm using the symfony framework to develop a web app. I'm using MySQL in the backend but want to keep my queries in their doctrine format to avoid any problems if I ever need to change databases. In one section of the web application I'm looking for the last comment associated by any distinct user, s...

HQL - find entity where property x is highest

Can HQL queries do this? "get the UserEntity where the property creationTimestamp is the most recent of all UserEntities". Essentially a query to return the "newest user" in our program where each UserEntity has a field mapped to a timestamp column in our database. ...

Problem with SQL Server Reporting Services

Hello. Friends I have a problem with SQL Server Reporting Services ..!!! I have some reports that show no data, the reports are on a separate server from the server that contains the database, the Data Sources of the reports is well configured. Stored procedures are executed while the server (display data) users have the necessary perm...

What the simplest way to sub-query a variable number of rows into fields of the parent query?

What the simplest way to sub-query a variable number of rows into fields of the parent query? PeopleTBL NameID int - unique Name varchar Data: 1,joe 2,frank 3,sam HobbyTBL HobbyID int - unique HobbyName varchar Data: 1,skiing 2,swimming HobbiesTBL NameID int HobbyID int Data: 1,1 ...

Minor mode to make the SQLi buffer more readable

When using Emacs to create a SQL query in SQL-mode, the SQLi buffer is the typical, ugly console window of the command-line tool for the target database. Most of the output is the same with ASCII characters trying to build a visual representation of a table. Has anyone created a minor mode to make the output more readable? Here are so...

Selecting entries by date - >= NOW(), MySQL

Hi everyone, I have a Calendar of Events table and I would like to select events with dates equal to or greater than today. When I use the following SELECT statement, it only retrieves events in the future (> NOW()): <?php $db->query("SELECT * FROM events WHERE event_date >= NOW()"); ?> How would I go about selecting all events t...

Does Visual Studio 2010 have SQL syntax highlighting for .sql files?

Basically the title is my question. I have a project in one of my solutions just for storing development assets like DB creation scripts and the like. While I normally use SSMS for developing and running these scripts, I would like to be able to open them in Visual Studio and see the same syntax highlighting that's in SSMS. It's just a...

Restricting table row in SQL Reporting 2008

Hey Guys Need to restrict the number of rows in my tablix, and have the left overs go to another page and also be restricted to the same amount and so on.... So my sample dataset has 2 records, to test I added a Grouping Expression as described here http://msdn.microsoft.com/en-us/library/ms157328.aspx =int((RowNumber(Nothing)-1)/1) ...

insert char into string at multiple positions sql

how would i like to convert accounting GL number 99999999999999999 to 999-99999-99-9999.999 in a query to MSSQL server 2005 i dont need to update the data, just have the STRING be converted on query. Table: GLM_MASTER__ACOUNT Field: Account thanks. ...

sql cascading deletes

I have a question about cascading deletes and foreign key references: Let's assume the following tables: ITEMX | ITEMY ------------------ | ------------ ID FKID_ITEMY | ID 1 1 | 1 2 1 | There is a cascade delete on FKID_ITEMY such that if I delete a row in ITEMX, the corre...

sql round function

Hi i need to round one decimal value to deicmal places which is passes as parameter. By doing : select round(n,@a) from tbl_Test where n is of type decimal 18,4 and @a=2 i got result but two zeros is added at the end. I want to get result without that zeros..but return value should be of ype decimal..not string. Is it possible anythi...

I am Trying to insert this data into SQL

I am trying to create the correct values for the tables I created. This is the code: INSERT DEPARTMENTS (Department_Id,Department_Name,Manager_Id,Location_Id) VALUES ('D0001,D0002,D0003','Think Tank,Creators,Marketers',NULL,'L0001,L0002,L0003') GO INSERT EMPLOYEES (Employee_Id,First_Name,Last_Name,Email,PhoneNumber,Hire_Date,Manager_ID...

Can the Select list in a SQL Statement use Regular Expressions

Hi all, I have a SQL statement, select ColumnName from Table And I get this result, Error 192.168.1.67 UserName 0bce6c62-1efb-416d-bce5-71c3c8247b75 An existing .... So anyway the field has a lot of stuff in it, I just want to get out the 'UserName'. Can I use a regex for that? I mean it would be kind of like this, select SUBST...

Can I set up materialised views on oracle for a SQL Server table over sqllink?

Hi, I have a table in a SQL Server database that needs to be visible to an oracle database. We have tried using a normal view over sqllink, but we are not able to create an onUpdate triggers on that view. I have read that we can create the trigger if it is a materialised view, but is unable to find any information on whether it can be ...

Whats wrong with this Data Explorer SQL query?

I am trying to write a How much did I type? query on Stack* Data Explorer. Modifying an existing query got me this far: -- How much did I type? DECLARE @UserId int = ##UserId## select sum(len(Body)) AS 'Posts' from posts where owneruserid = @UserId, select sum(len(Text)) AS 'Comments' from comments where userid = @UserId, (sele...

How to find number of observations in postgresql tables

Dear Folks, I am from DW/BI background using SAS for many years now I have task to find out number of records present in tables on the fly for postgresql tables i.e. In SAS we have meta tables which has details about tables and no of records, column info etc in system meta tables in a same manner is there any meta table available in p...

In search condition

Possible Duplicate: SQL NOT IN constraint and NULL values Why is following query not returning hello? select 'hello' where 'a' not in ('b', null) ...

Check SQL Server 2008 FIlestream status

Hello guys, Im using sql server 2008 filestream feature in one of my projects, is there a way to check the filestream status (if its enabled or not) using a query? Thanks in advance. ...

How to sum data week wise in SQL 2000

Dear All How to sum data week wise in MS-SQL 2000 I have a Table "Reports" with the following columns. TotalSubmissions, ZoneID, RptMonth, RptDay, RptYear 2,1,6,1,2010 1,1,6,2,2010 1,1,6,3,2010 1,2,6,1,2010 1,2,6,2,2010 2,2,6,3,2010 1,2,6,4,2010 1,4,6,1,2010 1,4,6,3,2010 1,4,6,4,2010 I want to make a report week wise for a specifi...