sql

CONTAINSTABLE query not recognising small words

I'm using CONTAINSTABLE to search two table columns. Once the search contains small words like 'the' 'for' 'a' the search returns no results even when they are actually present in the column. Quick example. Column being searched contains the text. 'System needs to be upgraded' Following SQL returns 0 rows SELECT * FROM Incident WH...

select where column1 are equals

I am using Oracle 10.2.0 and I am new with it. I need a sql Statement I have a table with 3 columns. in the column1 are numbers and same of them have equals values in column2 and cloumn3 are String. How can I get the Strings from column2 and column3 together separated with ";" when Numbers from column1 are equals. thanks ...

MySQL: how to select many results from linked table at one row to another?

Hello. At first - Im sql newbie, sorry for this (mbe typicall) question. I Have two table: table of organisations... id_org org_name 1 Organiz1 2 Organiz2 and table of organization staff. id_staff staff_name id_org 1 John 1 2 Jack 1 3 Sally 1 4 Peter ...

How to check db2 version

How to check db2 version on Z/OS using only SQL commands? Thanks, Melita ...

ADO.NET with Quartz.NET

I'm using Quartz.NET with a database, i.e. ADO.NET. Problem is, when my jobs are created, they are not being saved to the database at all. Have I configured everything right? I am using SQL Server Express, and the path to my database is 'chris\sqlexpress.Quartz.dbo'. Relevant parts of config file: quartz.jobStore.type = Quartz.Impl.Ado...

Stored procedure syntax Error(MSSQL)

Below mentioned stored procedure is giving error while creating Msg 156, Level 15, State 1, Procedure crosstab, Line 23 Incorrect syntax near the keyword 'pivot'. Can anyone please tell me the mistake? Below is the script: CREATE PROCEDURE crosstab @select varchar(8000), @sumfunc varchar(100), @pivot varchar(100), @table varchar(...

Replicating Data from One DB to another

Hey Guys, Im wondering if you could point me to a few possibilities in the best way to move/replicate data from one database on a different server to my database. Ideally any update on the other database would be immediately pushed to mine. Another thing i was thinking about ok lets say the master database has 100 tables I could build...

sqlite3 preparing, binding and reseting statments

Hi there, Can someone put more light on the functions: sqlite3_reset(); sqlite3_clear_bindings() I understand that I can use sqlite3_prepare() to translate sql string to native byte code which engine understands. Therefor the engine does not have to translate it every time when it is used. I can also parametrize such prepared state...

MS SQL bit variable can you Not(@a) ?

in c# i have a: a = !a (if false makes it true, if true makes it false) in sql i want to do the same with a BIT variable something like: declare @a bit set @a = 1 select @a set @a = not (@a) select @a can i? i could always do an IF, but this would "look better" :) ...

Does NHibernate support mapping from SQL Views?

Does NHibernate support mapping of SQL VIEWS? Any examples would be helpful. ...

TVF UDF does not return the same data as SELECT

Calling the UDF like so: SELECT product_name, SUM(quantity) AS SumQty, SUM(face_value) AS SumFaceValue, SUM(net_cost)AS SumNetCost, SUM(face_value - net_cost) AS SumScripRebate, organization_name FROM getSalesSummary(@GLSCOrgId, @BeginDate, @EndDate) getSalesSummary GROUP BY product_name, organi...

Django/SQL: what's most efficient, more columns or more tables?

I have a MySQL database that I'm using with Django. One of my tables has around 60 columns. I'm wondering whether to split it into 5-6 smaller tables. This would make logical sense, since the columns split nicely into 5-6 logical groups. The downside would be that some of the Django pages would then require 5-6 row queries instead of 1....

SQL MAX and MIN in one column

I have a problem to get the max and the min value, I want the result to be XXL and XXS SELECT MAX(tblSizeXL.SizeXLName) AS maxSize, MIN(tblSizeXL.SizeXLName) AS minSize FROM Product JOIN tblSizeXL ON Product.SizeXLID = tblSizeXL.SizeXLID WHERE (Product.GroupID = @GroupID) GROUP BY tblSizeXL.SizeXLID ORDER BY ...

SQL column permutation

Let's say I have a table with with one column made up of 4 rows. Names name1 name2 name3 name4 How could I get all permutations of this column rows. ie name1 name2 name3 name4 name1 name2 name4 name3 ETC. ...

Querying for ae matches æ in SQL Server / LINQ to SQL

When I try running... SELECT * FROM Users WHERE Username = 'ae' it returns matches where the username is æ (ash character). I was wondering if there's a way to support characters like the ash character but get an exact match for what I'm looking for. I'd like to search for ae and get just ae, not ae and æ I'm using SQL Server 2008 an...

Use like in T-SQl to search for words seperated by an unkown number of spaces

I have this query: select * from table where column like '%firstword[something]secondword[something]thirdword%' What do I replace [something] with to match an unknown number of spaces? Edited to add: % will not work as it matches any character, not just spaces. ...

MS SQL Server 2005 GROUP BY and SUM

Hey all, i am trying to create a report to show how much is spent per HRCode. This is my SQL Query so far: SELECT * FROM tblWO as WO, tblWOD as WOD, tblWA as WA WHERE WOD.OrderID = WO.ID AND WA.HRCode = WO.AdministratorCode AND WO.OrderDate BETWEEN '2010-01-01' AND '2010-08-31' AND Approved = '1' ORDER B...

Show failure for SQL 2005 Job that executes Powershell script through CMD prompt, IF PS script fails

I have a SQL 2005 instance that runs a job that uses a Powershell script to rename the current SQL TX Log backup file by appending "-PrevDay" to it, (subsequently deleting the backup already named "XXX-PrevDay.bak" if it exists), and then run a full backup of the DB and a TX Log backup, if the DB is not in Simple mode. SQL Job kicks off...

shell script which will interact with the database

Have been writing the shell script such as : #! /bin/bash `sqlplus -s <username>/<passwd>@dbname` set echo on set pagesize 0 set verify off set lines 32000 set trimspool on set feedback off `SELECT tr.number, count(*) as total FROM <dbname>.<tablename1> tr LEFT JOIN <tablename2> t2 ON t2.i...

psycopg2 equivalent of mysqldb.escape_string?

I'm passing some values into a postgres character field using psycopg2 in Python. Some of the string values contain periods, slashes, quotes etc. With MySQL I'd just escape the string with MySQLdb.escape_string(my_string) Is there an equivalent for psycopg2? ...