I have a table in SQL Server 2008 that looks kind of like this:
ID I1 I2 ... IN
-------------------------
1 2 3 ..... 2
2 0 0 ..... 0
3 2 1 ..... 5
Where IN is about 9 columns. What I need to do is count the number of rows, but skipping rows where the values of I1..IN are 0's. I'm new to SQL and I have basically...
I'm working on a personal project (Search engine) and have a bit of a dilemma.
At the moment it is optimized for writing data to the search index and significantly slow for search queries.
The DTA (Database Engine Tuning Adviser) recommends adding a couple of Indexed views inorder to speed up search queries. But this is to the detrimen...
My client wants to sort products by drag & drop. The drag & drop part is easy with javascript.
My problem is how do I save and get the sort order?
I'm using .net c# and SQL Server 2008.
When I move a product and drop it in a new position I get the id of the product that's moved, product in front and product behind. With this data I ...
I am using Spatial.NHibernate to save some geometry shapes to a Geography column in Sql Server 2008. Here is my mapping:
public class AreaMapping : ClassMap<Area>
{
public AreaMapping()
{
Id(c => c.Id).GeneratedBy.HiLo(100.ToString());
Map(c => c.Name).Not.Nullable();
Map(x => x.Boundary)
.Cus...
very basic question. sql server 2008, created new login and gave it sql authentication mode. checked status is enabled. Tried to connect to same server instance, login failed. What is going wrong? thanks for help in advance
...
I have a need to iterate over all of the tables in my database. I am doing so with thsi query:
SELECT so.name, so.*
FROM sysobjects so
WHERE so.xtype = 'U'
This works fine for all of the tables in the 'dbo' schema, but it doesn't work for any other schemas. I want the output to be like this:
Users.Address
Users.TelephoneNumbers
dbo...
There was a similar thread on this earlier, but my question is specific to upgrading from SQL2005 to 2008: when upgrading in-place is not possible because the machine has to be re-imaged, which method is preferrable - detaching and re-attaching the db files, or backup/restore?
Detach/attach is obviously faster and accoding to msdn possi...
We recently moved our database from our SQL Server 2005 server to our SQL Server 2008 server. Everything moved over fine, however now we are finding that we are getting collation conflicts. The old server had a different collation with the new server.
Now our tables created before the move are one collation, and the ones created after...
I have the following situation:
Customers contain projects and projects contain licenses.
Good because of archiving we won't delete anything but we use the IsDeleted instead.
Otherweise I could have used the cascade deletion.
Owkay I work with the repository pattern so I call
customerRepository.Delete(customer);
But here starts the...
Hello,
I am have a Silverlight app that connects to a local SQL Server db. It works as expected on my WinXP computer, but not on the Win7 x64 computer. (SQL Server 2008 installed.)
When I run the app, I get this error:
The remote server returned an error: NotFound.
My web.config, AppSettings:
<!-- For Development -->
<!--<add k...
I am using a TRY CATCH block in a stored procedure where I have two INSERT instructions.
If something goes wrong, the CATCH block takes care of rolling back all changes made and it works fine, except one thing!
The exception caught by my ASP.NET application is a SqlException with number 50000. This is not the original number! (the numb...
Hello,
I've been running an ASP.NET MVC application on my IIS 7.5 localhost (on my Win7 Pro box) server with SQL Server 2005 Developer Edition.
I went to put the application on my production server (IIS 7, SQL Server 2008) and am getting SQL Server connection errors. Here is the error I get when I try to browse site root:
A network-...
The environment setup has an ASP.NET webservice on IIS 6 connecting to a SQL Server over the network.
I am trying to understand, whether it's possible to secure the calls between IIS and SQL Server 2008. Is it possible? Is it something on the lines of SSL?
thanks for reading!
...
hi.. today i fot one error. i am not able to understand why it is. i hope somebody will help me here
my method is
public UserFamilyInfoBO GetUserFamilyInfo(Int64 UserId)
{
try
{
DataSet Ds = new DataSet();
SqlCommand Cmd = new SqlCommand("GetUserFamilyInfo", Cn);
...
Hi:
I have a scenario and not quite sure how to query it. As a sample, I have following table structure and want to get the history of the action for bus:
ID-----TIME---------BUSID----OPID----MOVING----STOPPED----PARKED----COUNT
1------10:10:10-----101------1101-----1---------0----------0---------15
2------10:10:11-----102------1102--...
(I know the circumstances surrounding the DTC and promoting a transaction can be a bit mysterious to those of us not in the know, but let me show you how my company is doing things, and if you can tell me why the DTC is getting involved, and if possible, what I can do to avoid it, I'd be grateful.)
I have code running on an ASP.Net webs...
Hi, I am using sql server 2008. Is there a way to generate a unique sequential number? It should exhibit properties of NEWID() and an identity column, meaning that it is always unique but each subsequent value is greater than the previous one. It can't be datetime/datetime2, because it is not unique enough.
Thanks.
...
Can I use SQL Server Express edition for commercial use?
Can our clients redistribute SQL Server Express edition with their application?
...
A SQL table has 100s of tables, SPs and functions.
I am trying to put together a sql query that will return all the dependencies of a given set of tables. Is there a way to accomplish this using SSMS without writing queries?
Updated:
Simplified the question to the point.
...
I have a table that consists of, among other things, two fields named StartTime and EndTime. Both are TIME fields.
I want to add a constraint preventing the insertion of any records that overlap with preexisting time ranges. E.g. if a record already exists with StartTime = 5:00, EndTime = 10:00, I would want an insert with StartTime = 6...