We have two tables in our application that both have a ShowOrder column.We are using NHibernate in our application and using HQL we join these two tables ordered by ShowOrder of first table and second table respectively.
Here's a simplified version of my query :
SELECT pr.Id as Id,pr.Title as Title, pr.ShowOrder as ShowOrder
FROM Proce...
Hello,
I get this error message when i try to using sql express:
An attempt to attach an auto-named
database for file
C:\Users\Name\Documents\Visual Studio
2008\Projects\MyProject\MyWeb\App_Data\MyDatabase.mdf
failed. A database with the same name
exists, or specified file cannot be
opened, or it is located on UNC share....
Is it possible to re-write this query to restart numbering when the UName changes so that my result set is:
1 FerrieC
2 FerrieC
3 FerrieC
1 GrayD
1 TimneyA
2 TimneyA
SELECT Row_Number() OVER (ORDER BY
u.UName) as RowNumber , u.UName FROM (
SELECT 'Ferriec' As UName UNION ALL
SELECT 'Ferriec' As UName UNION ALL
SEL...
I've been trawling books online and google incantations trying to find out what fill factor physically is in a leaf-page (SQL Server 2000 and 2005).
I understand that its the amount of room left free on a page when an index is created, but what I've not found is how that space is actually left: i.e., is it one big chunk towards the end ...
Does the order in which parameters are passed to a stored procedure affect the caching of query plans, or cause any other sort of extra processing overhead?
My theory is "no" for the query plans, and any processing overhead required to re-order the parameters is negligible, but I'd like to find some information to back it up.
...
I'm trying to update one value of a compound primary key from within the entity framework and I'm getting this error: "The property 'CustomerID' is part of the object's key information and cannot be modified. "
Here is my code:
Dim customer As Customer = (From c In db.Customer Where c.CustomerID = "xxx" AndAlso c.SiteKey = siteKey).Fi...
Hi there,
Been succcesfully adding records using Linq2Sql with the linq2sql genereated classes, works great..
But i need to now select the records, i can't seem to figure this out
This is how i am adding records - reservation is a generated linq2sql class
TestDataContext db = new TestDataContext();
db.Reserva...
I wanted to modify a column in a sql server 2005 table to IDENTITY(1,1)
Incidentally this table is empty and the column to be changed is a primary key.
This column is also a foreign key for two other tables.
After googling I found that you cannot use Alter table syntax to modify a column and make it an indentity column.
Link #1 : How...
On a SQL Server 2005 box, given that I have already created a key and a certificate for encryption usage...
CREATE CERTIFICATE [cert_Employee]
WITH SUBJECT = 'EmployeeTable_SSN protection'
CREATE SYMMETRIC KEY [key_Employee]
WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE [cert_Employee]
and the following definition...
Do you know if there's any way of doing this in SQL Server (2008)?
I'm working on a DataWarehouse loading process, so what I want to do is to drop the indexes of the partition being loaded so I can perform a quick bulk load, and then I can rebuild again the index at partition level.
I think that in Oracle it's possible to achieve this,...
Do these two queries differ from each other?
Query 1:
SELECT * FROM Table1, Table2 WHERE Table1.Id = Table2.RefId
Query 2:
SELECT * FROM Table1 INNER JOIN Table2 ON Table1.Id = Table2.RefId
I analysed both methods and they clearly produced the same actual execution plans. Do you know any cases where using inner joins would work in...
Hi,
I am having a stored proc which return 2 records and which contains a select statement from a temp table, So when i used this stored proc inside a OLEDB Source in SSIS and just trying to insert the set of records into a destination SQL table using OLEDB destination.
Its throwing a ERROR at source side saying :
[OLE DB Source [166...
We have a database running under MSDE (SQL 2000, service pack 4) that is reserving massive amounts of excess space. Using sp_spaceused for each table gives a total reserved size of 2102560 KB, a data size of 364456 KB and an unused size of 1690760 KB (i.e. reserving nearly 4 times the used space). The worst culprits are tables that are f...
I have rewritten an old program and designed a new database for it. I need to transfer the old data to the new database. The new database has a new schema, so I will have to manipulate much of the data that is going to be transfered.
I have thought about writing a console app with 2 linq to sql contexts, one for each database and coding...
Hello,
I have a variable called @status which I set before this select statement:
Select
ordr_num as num,
ordr_date as date,
ordr_ship_with as shipwith
From
order
where ordr_num = @ordrNum
I only want to select ordr_ship_with column if @status <> 'Cancelled', otherwise I want to select null for shipwith. How do I accomplish this?
...
Note: This issue appears to be limited to SQL Server 2005 SP2
I have a common table expression that iterates over a series of dates. I need to reference each of these dates in a call to a table-valued function. Something like this below, which gives a syntax error around the second parameter of the call to GetMyData. If I use another va...
In SQL Server Reporting Services 2008, I cannot always fix the Header row of a Tablix. Right-clicking the tablix and checking Repeat header rows on each page accomplishes nothing. Expanding the group panes to Advanced View and right-clicking numerous (Static) row group sections and changing properties RepeatOnNewPage to True works only i...
I have several horrors of old ASP web applications. Does anyone have any easy ways to find what scripts, pages, and stored procedures are no longer needed? (besides the stuff in "old___code", "delete_this", etc ;-)
...
I am trying to do record inserts on a table where the primary key is an Identity field.
I have tried calling mycontext.ExecuteCommand("SET identity_insert myTable ON") but this doesn't do any good.
I get an error saying that identity_insert is off when I submit changes.
How can I turn it ON from the c# code before I submit changes?
E...
An ActiveX Script in a DTS package can return DTSTaskExecResult_Success or DTSTaskExecResult_Failure. Is there a way to indicate that it is not a success without failing the entire package? We'd like it to keep going, but in a different direction. The options for a path are Success, Failure, and Completion, but it appears the only ret...