I have an import between 2 linked servers. I basically got to get the data from a multiple join into a table on my side.
The current query is something like this:
select a.*
from db1.dbo.tbl1 a
inner join db1.dbo.tbl2 on ...
inner join db1.dbo.tbl3 on ...
inner join db1.dbo.tbl4 on ...
inner join db2.dbo.mysid...
I have a Java-application that loads data from a legacy file format into an SQLite-Database using JDBC. If the database file specified does not exist, it is supposed to create a new one. Currently the schema for the database is hardcoded in the application. I would much rather have it in a separate file as an SQL-Script, but apparently t...
I'm using LINQ2SQL and I want to compare two tables and select all rows that are missing from one tables (based upon one of the column values).
In standard SQL I would write this as:
SELECT
FirstName,
LastName,
RefId,
Email
FROM
Users_ActiveDirectory AS ADU
WHERE
NOT EXISTS
(
SELECT
U.RefId
FROM
Users AS U
WHERE
U.RefID = ADU.RefId
)...
I am searching for an algorithm to fill several slots, which are already filled to some level.
The current levels and the available quantity to fill are known
Resulting levels should be as equal as possible, but existing level cannot be reduced
Slots are filled from left to right, so left slots get higher level if equal level is imposs...
i want to normalize date fields from an old badly designed db dump. i now need to update every row, where the datefield only contains the year.
update table set date = '01.01.' + date
where date like '____' and isnumeric(date) = 1 and date >= 1950
but this will not work, because sql does not do short circuit evaluation of boolean expr...
Following SQL get what I need:
SELECT TOP (50) [nodeId]
FROM [dbo].[cmsContentXml]
WHERE [xml] like '%creatorID="29"%'
AND [xml] like '%nodeType="1086"%'
ORDER BY [nodeId] DESC
I need to pass in the numbers as parameters, so I have follows:
exec sp_executesql N'SELECT TOP (@max) [nodeId] FROM [dbo].[cmsContentXml] WHERE...
Hi,
I have some xml and need to extract values using sql
<?xml version="1.0" ?>
<fields>
<field name="fld_AccomAttic">
<value>0</value>
</field>
<field name="fld_AccomBathroom">
<value>1</value>
</field>
</fields>
</xml>
I need to get
column name
fld_AccomAttic
Value
1
The xml is held in a sql server 2005 db
I ...
Hi there.
I've got a problem, and all articles or examples i found seem to not care about it.
I want to do some database actions in a transaction. What i want to do is very similar to most examples:
using (SqlConnection Conn = new SqlConnection(_ConnectionString))
{
try
{
Conn.Open();
SqlTransaction Trans = Conn....
I have an application that is deployed on tomcat on server A and sends queries to a huge variety of SQL Server databases on an server B.
I am concerned that my application could overload this SQL Server database server and would like some way to preventing it making requests to connect to any database on that server if some arbitrary nu...
So, I have three tables with the following rows: Customers (Customer_id and Name), Orders (Customer_id, Product_id, Quantity) and Products (Price).
How do I write a query which shows all customers who spent more than 1000$? Do I have to join the tables?
...
Im having two tables
TableA
Custid prodid Amt1
1 10 200
2 20 300
3 10 400
4 30 300
5 20 400
6 30 200
TableB
prodid Amt2
10 100
20 200
30 300
and i want sum of all amount group by prodid. can any one give me both ansi and Tsql quries.
...
Hi. I am using a PostgreSQL database, and in a table representing some measurements I've two columns: measurement, and interpolated. In the first I've the observation (measurement), and in the second the interpolated value depending on nearby values. Every record with an original value has also an interpolated value. However, there are a...
Hi,
I have a number of related databases that are version-ed. Instance of different versions may run side by side, identified by their different versions, i.e. [NorhwindV1.1] and [NorhwindV1.2] may be on the same server, along with [SouthwindV1.1] and [SouthwindV1.2].
There are a number of stored procedures that make cross database q...
Hello guyz,i am new to daatbase and class diagram.I just get scenarios from internet and try to develop ERD and Class Diagram for them.But the following scenario has caused me some problems, and i am not sure about my design.
"Whenever an employee fills leave application form, the leave application should be appeared for approval to his...
Say I have a database looking like this;
Product with columns [ProductName] [Price] [Misc] [Etc]
Order with columns [OrderID] [ProductName] [Quantity] [Misc] [Etc]
ProductName is primary key of Product, of some string type and unique.
OrderID is primary key and of some integer type, and ProductName being a foreign key.
Say I change ...
Hi,
For a few months we're developing an olap cube on SQL 2005. We deploy this cube on the local server which worked fine until a few weeks ago.
From that moment we got got an error while delpoying the cube.
"Error 1 File system error: Error opening file; \?\C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\SSAS_Funda.0.db\Dim B...
I have two tables with the following schema:
CREATE TABLE sales_data (
sales_time date NOT NULL,
product_id integer NOT NULL,
sales_amt double NOT NULL
);
CREATE TABLE date_dimension (
id integer NOT NULL,
datestamp date NOT NULL,
day_part integer NOT NULL,
week_part integer NOT NULL,
month_part intege...
I've been looking for a C++ SQL library implementation that is simple to hook in like SQLite, but faster and smaller. My projects are in games development and there's definitely a cutoff point between needing to pass the ACID test and wanting some extreme performance. I'm willing to move away from SQL string style queries, allowing it to...
With a table created using this SQL
Create Table X (
ID varchar(4) Not Null,
XDATE date
);
and an entity class defined like so
@Entity
@Table(name = "X")
public class X implements Serializable {
@Id
@Basic(optional = false)
@Column(name = "ID", nullable = false, length = 4)
private String id;
@Column(name ...
SQL Pivot Help:
I have three tables as follows:
Class Table:
ID Name
1 N1
2 N2
3 N3
Flags Table:
ID ClassID Flags
1 1 F1
1 1 F2
1 2 F3
1 3 F1
1 3 F3
Session Table:
ID ClassID Session
1 1 S1
2 1 S2
3 1 S3
4 2 S2
5 ...