Hello! I am trying to develop a SQL Server 2005 query but I'm being unsuccessful at the moment. I trying every different approach that I know, like derived tables, sub-queries, CTE's, etc, but I couldn't solve the problem. I won't post the queries I tried here because they involve many other columns and tables, but I will try to explain ...
In SQLServer 2005, is it possible to migrate a database from a workstation to another and also take the Replication configuration with it?
I mean, besides creating scripts.
...
I do not have 'full' the version of MS SQL (SQL Express 2008) so I do not have the profiler tool.
I want to see the SQL generated by my Entity Framework code, but all of the examples I find use the
var x = from u in table
select u;
type of syntax; But most of my queries are more like ..
var x = context.Users.Single(n => n....
I have the following table layout. Each line value will always be unique. There will never be more than one instance of the same Id, Name, and Line.
Id Name Line
1 A Z
2 B Y
3 C X
3 C W
4 D W
I would like to query the data so that the Line field becomes a column. If the value exists, a 1 is applied in the field ...
Folks,
I have a stored proc as following:
create procedure p1 as
begin
declare @n1 int
select
@n1=count(*)
from
Employee
select top 100
*
from
Employee
return @n1
end
I want to capture @n1 as well as the Employee resultset using Linq To SQL in my C# code.
I would appreciate any...
Hi, i have to save a file in any format (XLS, PDF, DOC, JPG ....) in a database using Java. in my experience i would have do this by storing the binary data of the file into a BLOB type field, someone told me that an alternative is coding the binary data as Text using BASE64 and store the string in a TEXT type field. Which one is the be...
I could use some help determining the best (most performant / easily maintainable) strategy for retrieving parent-child objects from a SQL db.
I inherited this code, and I've got relatively short deadline on this and I want to do as little foundational changes as possible. I'll have plenty of time to implement nhibernate or other ORM wi...
I'm soon going to be involved in a project to replace our current method of replication from transactional replication to some other method (for various reasons). I'm considering using CDC as an alternate method. I'm envisioning CDC capturing all the changes and then another process would read the changes and apply them to a target datab...
I have a couple of big datasets ( ~O(1TB) ), which I want to to import into my database. I use BULK INSERT to import data into temporary tables, then use SELECT and INSERT INTO to fill my real tables with the data. This is because I want to change the order of some things, and split some data files into logical tables. And if this functi...
I need to build a table for some new components that will keep track of available and used inventory. It will be something like this:
CREATE TABLE components
(
component_Id int NOT NULL PRIMARY KEY,
workOrder_Id int FOREIGN KEY,
componentSerial varchar(25) NOT NULL,
foo varchar(50),
bar int,
information nvarchar(250)
...
I'm trying to 'bin' all of my customers based on the number of items purchased, and display the counts of each bin. I'm trying to see how many people(account_id) purchased one item, how many purchased two items, all the way through nine items, and then ten or more.
Here's the query I'm using - for what its worth, I'd expect the query t...
Hi,
does anyone know a way of filtering a QuerySet by a field that was added through the extra() method?
For example, this is what I would like to do
_list_items = ListItem.objects.filter(list=1).extra(select=
'SELECT value AS "type" FROM list_item_optional
WHERE list_item_optional.list_optional_id=1
AND list_ite...
Hi
Based on the below tables
Table_A
Id RelatedId
---------------
1 1
1 2
1 3
2 4
2 5
2 2
3 7
3 8
4 9
Table_B
RelatedId Name
--------------
2 A
3 B
I want to get all the rows from Table_A which have atleast one matching relatedid in Table_B. The Ids from Table_A that do not have match in Table...
I have a table on a iSeries(IBM-i/AS400) which has some constraints. The table is created with SQL like so, with a handful of foreign keys linking from other tables to this table (actual SQL has been a bit obfuscated here):
CREATE TABLE ABCLIB.ABCDE (
DEIDN INTEGER NOT NULL WITH DEFAULT,
DETTL VARGRAPHIC (50) ALLOCATE(25),
DETY...
i am new to visual studio and sql server. I want to connect my vb.net application to sql server database on the same machine. what user can i use to connect sql server?
...
There are two tables, a Contact Table and a RelationshipHistory Table.
Contacts can have several types of relationships (Business, Individual, Volunteer, etc) which means they can have several references in the RelationshipHistory table over time. Each relationship row has a column indicating an event that the relationship is related to....
If we want to change the name of MyColumnName to MyAlteredColumnName...
...and we have a SQL Server 2008 table that looks like:
MyTable
MyColumnName
and a view that references the underlying column:
CREATE VIEW MyDependentView WITH SCHEMABINDING
AS
SELECT ..., MyTable.MyColumnName
We end up following this procedure:
Dropping t...
Hello,
I need to use the MySQL Order By function in a query except I need it to be in reverse order by number - therefore like 45, 32, 12, 10 instead of 10, 12, 32, 45. I would then limit it to 1 so I would get the highest number in the list. However if you have another way to do this that would be great thanks :D
Anyway thanks for you...
How can I create a YQL Query that will return me companies from Yahoo Finance?
select * from yahoo.finance.quotes where name like "apple"
Doesn't work.
...
I'm trying to figure out how to query my database so that it will essentially first ORDER my results and then GROUP them... This question seems to be slightly common and I have found examples but I still don't quite grasp the 'how' to do this and use the examples in my own situation.... So all help is definitely appreciated.
Here are my...