Pawnshop Application (any RDBMS):
one-to-many relationship where each customer (master) can have many transactions (detail).
customer(
id serial,
pk_name char(30), {PATERNAL-NAME MATERNAL-NAME, FIRST-NAME MIDDLE-NAME-INITIAL}
[...]
);
unique index on id;
unique cluster index on pk_name;
transaction(
fk_name char(30),
tran_type char(1...
I have a table with the following structure:
CREATE TABLE items (
id serial not null,
title character varying(255),
version_id integer DEFAULT 1,
parent_id integer,
CONSTRAINT items_pkey PRIMARY KEY (id)
)
So the table contains rows that looks as so:
id: 1, title: "Version 1", version_id: 1, parent_id: 1
id: 2, ti...
I am using SQLite,
TABLE A
(
ID
FileNAME
FOLDERID
)
TABLE B
(
FOLDERID
FOLDERPATH
)
I want to write a sql statement to delete all files in A where its Folder is subfolder of C:\ABC\;
How Can I make it in one sqlite statement, and is it the best way to do?
Many thanks!
...
A tough SQL question (I'm using postgres by the way).
I need the first row inserted every day for the past X days. one of my columns is a timestamp, which i hold the time inserted, and another column is the row id.
If it's not possible to get the first row inserted every day, i at least need a unique one; a single row for every day fo...
Scenario is.... I have to select a row in datagridview and save those datas to database.It can any number of columns present. how to achieve this..
...
Hello . I have the following problem.
I have an object with some DateTime properties , and a Table in database that I store all that objects , in Sql server I want to store the DateTime properties in some columns of DateTime Datatype, but the format of datetime in sql server is different from the DateTime class in c# and I got an sql ex...
hi all,
hope that everybody here is OK.
We are using VS 2008 as development tool, TFS 2008 as version control as well as build automation. Some of our developer use dbpro for databases changes and some use SQL Server management studio.
I am trying to automate build for Web Application built using C# and VB.Net.
Our scenario is such tha...
I'm creating a project tasklist application. I have project, section, task, issue classes, and would like to use one class to be able to add simple notes to any object instance of those classes.
The task, issue tables both use a standard identity field as a primary key.
The section table has a two field primary key.
The project table ...
I have a table like this
C1 C2 C3 Code
1 2 3 33
1 2 3 34
2 4 1 14
1 2 3 14
i want to select only those record whose code is appearing only in single row. ie, in this case rows with code 33 and 34.. as they appear only once in this table.
How can i write a query for that
...
Is it a query without a 'WHERE param=value' statement?
Apologies for the simplicity of this one...
...
Hi
I feel stupid, but I can't get a TIMESTAMP column to be shown in human understandable way in a SELECT.
I could do that in MySQL, not in sqlite3.
Could someone show me an example please?
Thanks
...
I'm contemplating a single SQL trigger to handle INSERT, UPDATE and DELETE operations as part of an auditing process.
Is there any statement, function or @@ variable I can interrogate to find out which operation type launched the trigger?
I've seen the following pattern:
declare @type char(1)
if exists (select * from inserted)
if ...
I've got three tables; Auctions, Auction Bids and Users. The table structure looks something like this:
Auctions:
id title
-- -----
1 Auction 1
2 Auction 2
Auction Bids:
id user_id auction_id bid_amt
-- ------- ---------- -------
1 1 1 200.00
2 2 1...
hi, i have a view as below.
SELECT TOP (100) PERCENT 'SA' AS Doc_Type1, 'A' + SUBSTRING('000000', 1, 6 - LEN(CAST(dbo.companies.companyId AS varchar(10))))
+ CAST(dbo.companies.companyId AS varchar(10)) AS Client_ID, 1200 AS Bank_Nom, 0 AS Department, CONVERT(nvarchar(20),
dbo.invoices.i...
I have some data in a view which I want to insert into a table (same table schema) what's the easiest, cleanest way to do it.
...
my query is showing in row 2000 the data of 2000-2001 & in 2001 the data of 2001-2002.
how can i change the column so that it displayes
column 1 column 2
2000-2001 5
2001-2002 3
2002-2003 9
2003-2004 12
.
.
.
.
and so on...
...
I'm currently using sp_executesql to execute a T-SQL statement with a dynamic table name. However, it is really ugly to see something like:
set @sql = 'UPDATE '+Table_Name+' SET ... WHERE '+someVar+' = ... AND '+someVar2' = ...'
sp_executesql @sql
What I would rather like to have is a TABLE variable of which is a reference to a table...
I Have a View in SQL Server, in one column ( data type int64) it returns Null value!
But I want to display Zero in it. How Can I define a default Value for Column in View?
...
I have 2 databases on SQL (identical). I want a table from one database to be copied to the other database. They are both the same name and the original table can be overeritten.
Cheers
...
error returns to me in below codes:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'ENG_PREP'.
insert into ENG_PREP VALUES('572012-01-1,572012-01-2,572012-01-3,572013-01-1,572013-01-2',
'',
'500',
'',
'A320 P.001-A',
'Removal of the LH Wing Safety Rope',
'',
'',
'',
'0',
'',
'AF',
'12-00-00-081-001',
'',
'',
'',
'',
'',
'...