If you have a table with a clustered index on the Primary Key (int), is it redundant and bad to have one (ore more) non-clustered indexes that include that primary key column as one of the columns in the non-clustered index?
...
So I am in the process of redesigning a small database (and potentially a much larger one) but want to show the value of using revisions / history of the business objects. I am switching the data from Access to MSSQL 2008.
I am having a lot of internal debate on what version of "revision history" to use in the design itself - and thou...
I have a query that works:
DECLARE @ProductID int
SET @ProductID = '1234'
SELECT DISTINCT TOP 12 a.ProductID
FROM A a
WHERE a.CategoryID IN (SELECT b.CategoryID FROM B b WHERE b.ProductID = @ProductID)
AND a.ProductID != @ProductID
It returns a list of 12 product numbers, all unique.
I need to store these results in a variable, comm...
Is there any easy way to execute a chunk of code instead of moving cursor to the beginning of code chunk, and shift + down arrow to the end of code, then hit F5?
Is there any keyboard shortcut to duplicate line (duplicate several lines), delete line (delete several lines)?
Thanks.
...
Setting up SSRS. For Service Account,
I set a domain account as the Report Server Service Account.
click apply
SQL Server Connection Dialog pops up. Need to specify an account with admin privileges.
set Credentials Type = SQL Server Account
I use sa account (which works, verified many ways with sql server management studio)
I f...
When installing SQL Server Express Edition 2008, checklist says
"Previous version of Visual Studio 2008"
and asked me to upgrade to sp1. Unfortunately sp1 for some reason refuses to install on my brand new pc (Windows 7).
So why can't I just bypass this ? Why would SQL Server Express needs VS2008 to install that's insane.
SQL Server ...
I am creating a desktop application that stores rich text documents to a SQL Compact database. Documents are converted to a byte array and stored as a Binary column, and I am running into SQL Compact's 8K limit for Binary field length.
Is there a simple way to get around the 8K limit? I can come up with lots of complicated ways to do it...
In SSMS when click on database "Tasks -> Generate Scripts" I get an output script. How to make the same with non graphical tool?
...
This is a follow-up to another question I asked earlier today. I am creating a desktop app that stores rich text documents created in WPF (in a RichTextBox control). The app uses SQL Compact, and up until now, I had planned to store each document in a binary column in the database.
I am rethinking that approach. Would it be better pra...
I am a bit confused SQL server windows login and credential. On books online, it says that credential can access resources beyond sql server, but as far as i see windows login might be able to do that that since it is mapped to a windows user. Am i missing something else?
Thanks, in advance.
...
Hey,
I rewrite application from ASP.NET to Silverlight and use NHibernate 2.
Tables in my db looks like this:
In Dziecko table I have reference to id of Opiekun and Grupy. In ASP it's ok for me but in videos Summer with NHibernate I see that Stephen Bohlen in exchange use object of this type, for me its Opiekun and Grupy.But in SQL Se...
I have a table references to itself.
User table: id, username, managerid and managerid links back to id
Now, I want to get all the managers including direct manager, manager of direct manager, so on and so forth... The problem is that I do not want to have a unstop recursive sql.
So, I want to check if an id alreay in a list, I will ...
Hello,
I am using sql 2008 full text search and I am having serious issues with performance depending on how I use Contains or ContainsTable.
Here are sample: (table one has about 5000 records and there is a covered index on table1 which has all the fields in the where clause. I tried to simplify the statements so forgive me if there ...
I need to find the amount of updated rows
UPDATE Table SET value=2 WHERE value2=1
declare @aaa int
set @aaa = @@ROWCOUNT
It doesn't work. How can I do that?
...
Hi there,
I am trying to write a sql statement that
I have 2 tables Store & StoreTransactions.
My first select command looks like
SELECT [StoreID],[ParentStoreID]
FROM Store
Very simple stuff. How do I take the returned StoreID's and use them for my 2nd select statement?
SELECT [StoreTransactionID],[TransactionDate],[StoreID]
FRO...
When I connect Access 2007 to SQL Server (whether by ADO recordset or by linked table) I no longer get check box lists (of available filter values) in the datasheet column filters.
Is this feature available only with MDB/ACCDB and/or DAO?
...
I have a Table called Address. I have a Trigger for insert on that table that does some spacial calculations on the address that determines what neighborhood boundaries it is in.
address = new Address
{
Street = this.Street,
City = this.City,
State = this.State,
...
I am aware of:
SELECT @@ERROR
but it will give me only an ERROR CODE (a number) and I need a full text message like:
Cannot insert duplicate key row in object 'dbo.TABLE_NAME' with unique index 'IX_ID_unique'.
The statement has been terminated.
How can I do that in MS Sql Server 2005 ?
EDIT: I need to acquire this error me...
I have a system with a few different databases, and I would like to check if a certain database is down, and if so display a message to the user.
Is it possible in NHibernate to check if there is an active connection to the database, without having to request data and then catch the exception?
...
Hi,
I recently contacted a web host regarding support for external database access to a Microsoft SQL Server database included in a package they offer. They replied saying that it is only possible with an SSH-tunnel.
Is it possible to connect to a SQL Server database in Visual Studio using an SSH-tunnel? It is important for me to be ab...