sql-server

Service Broker is not starting

Hi ALTER DATABASE [Database Name] SET ENABLE_BROKER; Does not respond, and works infinitely. SQL Agent service is running, what is chances? Thanks ...

Set time part of datetime variable to 18:00

Hi. I need to set datetime variable to two days from now but it's time part must be 18:00. For example if i call getdate() now i'll get 2010-05-17 13:18:07.260. I need to set it to 2010-05-19 18:00:00.000. Does anybody have a good snippet for that or any ideas how to do it right? ...

Can you optimize this code? T-SQL

Essentially I have three fields and I am creating a new one which is the three combined making a mailable address; problem being some fields contain null values and adding myString to a null just produces a null in sql. So this is my code, can anyone make it any cleaner? It's still looking pretty butch! UPDATE [mydb].[dbo].[Account]...

SQL to search duplicates

I have a table for animals like Lion Tiger Elephant Jaguar List item Cheetah Puma Rhino I want to insert new animals in this table and I am t reading the animal names from a CSV file. Suppose I got following names in the file Lion,Tiger,Jaguar as these animals are already in "Animals" table, What should be a single SQL query tha...

Analysis Services with excel as front end - is it possible to get the nicer UI that powerpivot provides.

I have been looking into PowerPivot and concluded that for "self service BI" and ahoc buidling of cubes it has its uses. In particular I like the enhanced UI that you get from using PowerPivot rather than just using a PivotTable hooked up to an analysis services datasource. However it seems that hooking up PowerPivot to an existing anal...

How significant is a performance penalty for using Int64/bigint instead of Int32/int in a C#4/T-SQL2008 application under 32-bit Windows XP?

For a scientific project of mine I am developing (in C#4 and T-SQL) an application potentially meant to handle very big quantities of very simple records performing simple operations with them (a scientific simulation engine, not a linear time-series cruncher). I'd like to use 64-bit integers as primary keys for better capacity. I am ...

SQL Server 2005 user permissions

I have created a database and some dbo.tables. Now I want to create a user that are can read and write to these tables, but not modify or drop. However I want this user to be able to create own tables and let him do what he want with these. Is this possible? Could someone explain how this can be done? ...

Update with inner join ?

I have two databases: DB1 and DB2 How to do something like: update myServer.DB1.dbo.hotels.Name = myServer.DB2.dbo.hotels.Name join myServer.DB2.dbo.hotels on myServer.DB2.dbo.hotels.Code= myServer.DB1.dbo.hotels.Code where myServer.DB2.dbo.hotels.CountryCoe != myServer.DB1.dbo.hotels.CountryCode ...

Tags list in stackoverflow

Hi experts, I am working on website in asp.net mvc. There is form where user is asked to put some information along with the Tags similar to stackoverflow. this tags information is saved in the same table in field Tags. Now I want to show them a help to select tags from the list (same as in stackoverflow). how can i extract it from the...

SQL Server cluster install issue

Hello everyone, I am going to install SQL Server 2008 Enterprise cluster on Windows Server 2008. I am wondering whether I have to setup a Windows domain (or active directory) in order to install SQL Server cluster? thanks in advance, George ...

How to research unmanaged memory leaks in .NET?

I have a WCF service running over MSMQ. Memory gradually increases over time, indicating that there is some sort of memory leak. I ran the service locally and monitored some counters using PerfMon. Total CLR memory managed heap bytes remains relatively constant, while the process' private bytes increases over time. This leads me to b...

sql report link with rs:Command paramaters not opening in JSF page

I have a report that we need to link (which we've checked to be working) to in a JSF project, the link looks like the following: http://www.example.com/report/summary&rs:Command=Render However when we try to load the page that links to it we get the following error: The reference to entity "rs:Command" must end with the ';' ...

When to use Stored Procedures instead of using any ORM with programming logic?

Hi all I wanted to know when I should prefer writing stored procedures over writing programming logic and pulling data using a ORM or something else. ...

storing images in sqlserver using c#

i want to store images of my employees with thier profiles in sql server database. i have following reservations. whether i should compress images or not if yes please provide me sample code or article how should i retrieve images efficiently, i an afraid of asp.net application performance issue. i think with ten thousand employee recor...

Using current database name in T-SQL has Using statement

Hello everybody. I have application runs T-SQL statements to update more than one database the problem is i'm using the following t-sql USE [msdb] GO DECLARE @jobId BINARY(16) EXEC msdb.dbo.sp_add_job @job_name=N'test2', @enabled=1, @start_step_id=1, @notify_level_eventlog=0, @notify_level_email=2, ...

What does a modern, standard Microsoft-based technology stack look like?

Let's say I asked Microsoft to describe the perfect, modern, Microsoft-based technology stack to power a standard e-commerce web site, which perhaps has a simple 2-tier web/database architecture. What would it be like? Yes, I'm just looking for a list of product / technology names. For example, in the J2EE world, I might describe a stac...

Good way to format decimal in SQL Server

We store a decimal(9,8) in our database. It can have any number of places after the decimal point (well, no more than 8). I am frustrated because I want to display it as human-readable text as part of a larger string created on the server. I want as many decimals to the right of the decimal point as are non-zero, for example: 0.05 0....

How can I drive a boolean field in SQL Server off of a nullable column?

I'd like to have two columns in a database, one for tracking whether or not the user has submitted something, and another for the timestamp of that submission. How can I structure the table definition so that the state of these two columns is never inconsistent? Basically, I'd like the boolean field to be driven by whether or not a Sub...

Disable constraints during transaction

I am putting together a table that will be used to send follow up messages to certain requests for information. A request is sent to a group of people and responses are tracked. If a person fails to respond, zero or more follow ups might be sent. I created a table: FollowupId int primary key, RequestId int foreign key (outside this exa...

Ordering sql query results

My sql query gives the columns: product_id (which is an integer) pnl (which is float - can be negative) I get more than 100 rows. I want to filter out the top 40 rows based on abs(pnl). But the results should be ordered by pnl column only and not by abs(pnl). I want to do this for MSSQL 2005. Is there a way to do this? ...