Hello,
im using the PATINDEX sentence into a case sentence:
select Choosed1=
CASE PATINDEX('%1|%',field1)
//Here im getting an error:
WHEN >0 THEN 'X'
END
from testtable
How could i put the >0 condition to avoid the error?
Thanks in advance
Best Regards.
Jose
...
I have four tables:
cuisines(id, name);
recipes(id, cuisine_id, name, picture);
ingredients(id, name);
ingredients_recipes(ingredient_id, recipe_id);
the last table references the Many-To-Many relationship between recipes and ingredients. How can I select all cuisines which contain tomatoes (i.e. the cuisine has recipes which have ...
Hi,
I've created an SQL stored procedure:
CREATE PROCEDURE usp_MyTableInsert
...
@name varchar(100),
@birthdate datetime = NULL,
@phoneno varchar(10),
...
And I call it from ColdFusion code:
<cfstoredproc
datasource="training"
procedure="usp_MyTableInsert">
....
<cfprocparam cfsqltype="CF_SQL_VARCHAR" value="#form.name#...
In the JIndent formatter you can add "special" comments that prevent the formatter from processing a group of lines (//J-, //J+, if I remember correctly).
Is there an equivalent for the built-in formatter in IntelliJ IDEA (9.0.3 CE)? I'm normally very anal about my code style :-), but one of my colleagues is writing a chunk of SQL (in S...
I want to return rows from a select statement within a declare/begin/end block. I can do this in T-SQL but I would like to know how to do it in PL/SQL.
The code looks a bit like the following:
declare
blah number := 42;
begin
select *
from x
where x.value = blah;
end;
...
Hello.
I have a table with two fields:
id(uuid) that is primaryKey and
description (var255)
I want to insert random data with sql sentance.
I would like that description would be something random.
Can some1 please help me with this?
PS: im using postgresql.
...
With following code,I have identity_insert turned on to be able to insert some value explicitly:
SET IDENTITY_INSERT dbo.myTable ON
Go
the identity insert is set to be primary key and not null
in my c# program,when i want to insert a value,this error is generated:
IDENTITY_INSERT is turned off
but i have turned it on
what's the pr...
I’ve had an open ticket with Microsoft on a timeout issue we are having for over a month now with no resolution. I’m throwing the problem out to see if anybody else is experiencing this and any suggested work-arounds.
SS2005, SP3 database running on WinSrvr2003 cluster with NETAPP SAN.
Problem is that we are experiencing dotnet applic...
Hi,
I am exporting data from an Oracle database to csv file using the spool command as follows:
set heading off
set linesize 1000
set long 1000
set pagesize 0
set echo off
set verify off
spool D:\OVERNIGHT\TEMP_FILES\SE_NEW_PFRA_CRYSTAL_OUTPUT.txt
SELECT
TRIM(FU_BAN) ||'|'||
TRIM(CASE_ID) ||'|'||
TRIM(case when fu_type is null then ...
A fully normalized database with no redundant data is good "academically", but has terrible real-world performance.
The first optimization is obviously a cache system. After this, for creating redundant data for performance, when or why would (or wouldn't) you use triggers over a cron task that calls a script to update the redundant dat...
how to connect Sqlcompact via. OleDbConnection
my code:
string strConn = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source=C:\\newservice\\UserDataBase\\demo1.sdf;Password=MyPassword";
conn = new OleDbConnection(strConn);
conn.Open();
DataTable dtTable = new DataTable("Record");
OleDbDataAd...
I need to clear many tables (preferably truncate table). But tables have many FK constraints. I tried something like this, but failed:-
ALTER TABLE Table1 NOCHECK CONSTRAINT ALL
TRUNCATE TABLE Table1
ALTER TABLE Table1 WITH CHECK CHECK CONSTRAINT ALL
This is the error i am getting:-
Cannot truncate table 'Test' because it is being r...
hi guys, I'm stuck with a homework..
How can I from this table check what cID, sID = '03' are taking? And with that, checking other sID that got the same cID as sID = '03' and select it out?
sID cID year grades
--------------------------------
01 L21D 1997 4
01 L24D 1998 2
01 L32D 1998 3
02 L21D 19...
I am making a PHP utility that imports and analyzes a CSV file into $data, and whether or not to INSERT "new" rows into the database ($saveNew).
Right now, I have a bit of an ugly mess: (in generalized pseudo-PHP)
function synchronize($data,$saveNew) {
$existing_ids = $table->find_all('ID'); //array of ID's in the table
$incomi...
How can I create a composite key on multiple columns, one of which can have some value but not null (or some constant value)?
For example:
PK Loc_ID Date Time Cancelled
1 1 01/01/2010 10:00AM YES
2 1 01/01/2010 10:00AM YES
3 1 01/...
I've been asked to find out why a program is failing. I've traced it to a SQL stored procedure. The program passes in the name of a file that the st. proc. presumably tries to read.
However, the SQL server is returning an error indicating that it cannot access the file because access is denied.
My connection string says Integrated Se...
Hello, Hope someone can help - I am a novice SQL hacker (and very bad at it indeed!)
I have two tables on SQL Server 2005 TABLE 1 and TABLE2:
TABLE1
COL1 COL2
1 10
2 20
3 30
4 10
4 20
5 20
6 30
7 10
7 20
TABLE2
COL1 CO...
Hi there, we've got a real confusing problem. We're trying to test an SQL Bulk Load using a little app we've written that passes in the datafile XML, the schema, and the SQL database connection string. It's very simple (the program is five lines, more or less) but we're getting the following error from the library we're passing this stuf...
I need to do the following query (for example):
SELECT c1.CustomerName FROM Customer as c1
INNER JOIN [ExternalServer].[Database].[dbo].[Customer] as c2
ON c2.RefId = c1.RefId
For some security reason my client doesn't allow me to create a linked server. The user under whom I execute this query has access to both tables. Is it possibl...
Is there any rule for the SQLite's column name?
Can it have characters like '/'?
Can it be UTF-8?
...