sql-server

SQL Server: is ther a way to grant execute using GUI

Is there a way to grant execute permissions for a role or a user using GUI (not T-SQL)? I'm using SQL Server 2008 SP1. ...

Help with concept - filters and number of items

Please check http://www.alibaba.com/catalogs/cid/702/Laptops.html they have nice filter here with number of items for each. Note one detail - they have locations here. Same thing on olx.com - location and number of items for each category. Now imagine I have tables: [products] (Id, Name, CategoryId, LocationId) [Categories] (Id,Name) [...

Creating a database instance in C#

Is it possible to create a sql database instance with C# code. I have no problem adding a database to an existing SQL instance, for example WONEA\SQLEXPRESS but for creating another SQL instance such as WONEA\SQLEXPRESSTEST I'm a little stumped. Help! ...

Performance overhead of TDE on SQL Server 2008

Has anyone used TDE on SQL Server 2008? What are the performance overheads? ...

Naming of boolean column in database table

I have 'Service' table and the following column description as below Is User Verification Required for service ? Is User's Email Activation Required for the service ? Is User's Mobile Activation required for the service ? I Hesitate in naming these columns as below IsVerificationRequired IsEmailActivationRequired IsMobileActivatio...

asp.net, sql server., project management system, email integration issue

Hi I am working on a project management system using asp.net and sql server. I would like to implement the "email integration" feature like most other softwares where lets say whenever a message is posted against a task, bug or something you get an email, and when you reply to that email your message gets posted to the thread automatica...

SQL Server join question

This is on Microsoft SQL Server. We have a query where we are trying to join two tables on fields containing numeric data. One table has the field defined as numeric(18,2) and the other table has the field defined as decimal(24,4). When joining with the native data types, the query hangs and we run out of patience before it will finish ...

UUID collision risk using different algorithms

Hi Guys, I have a database where 2 (or maybe 3 or 4) different applications are inserting information. The new information has IDs of the type GUID/UUID, but each application is using a different algorithm to generate the IDs. For example, one is using the NHibernate's "guid.comb", other is using the SQLServer's NEWID(), other might want...

Get non-overlapping dates ranges for prices history data

Hello, Let's assume that I have the following table: CREATE TABLE [dbo].[PricesHist] ( [Product] [varchar](6) NOT NULL, [Price] [float] NOT NULL, [StartDate] [datetime] NOT NULL, [EndDate] [datetime] NOT NULL ) INSERT [dbo].[PricesHist] ([Product], [Price], [StartDate], [EndDate]) VALUES (N'Apples', 4.9, CAST(0x00009D2C00...

Complex select query question for hardcore SQL designers

Very complex query been trying to construct it for few days with more real success. I'm using SQL-SERVER 2005 Standard What i need is : 5 CampaignVariants from Campaigns whereas 2 are with the largest PPU number set and 3 are random. Next condition is that CampaignDailyBudget and CampaignTotalBudget are below what is set in Campaign ...

i need to do a view in sql that returns the latest invoice date for each company

hi, i have a company table that is dbo.companies and has companyId as a column. I also have an invoice table that is dbo.invoices with invoicecompanyId column (which is the same as the companyId on the other table) and it also has a column called invoicedate. What i am mtrying to achieve is a view of each companyid with the corresponding...

Conditional Common Table Expression (CTE) in SQL

Hi I'm trying to select the hierarchy of a product category tree in SQL. My code looks as follows. I'm trying to achieve a dynamic sort order, using IF or Case When on the SortOrder parameter. The commented line should be active if @SortOrder is equal to 'sortorder'. I tried to add If Else statement around it, but I failed... Can yo...

sql connection string from AD account in web.config

Infrastructure has created an active directory account for me that has read access to the SQL 2008 database I need to query. The web application I've created does NOT use this account to run so I can't use Identity Impersonate="true" to access my datasource. Is there a way in my connectionstrings node to just input the AD UN/PW combina...

SQL Agent Command Line Not Saved

I have a SSIS package I am trying to schedule. I create a new job under SQL Server Agent. On the Command line tab of the jobstep, I choose "Edit the command-line manually". The changes are retained as I switch from tab to tab within the job step but whenever I exit and save the job, the changes are lost. Any ideas what's going on? I'm...

SSIS - Skip Missing Files

I have a SSIS 2008 package that calls about 25 other SSIS packages. Each of those child packages loads a specific file into a table. But sometimes one or more of these input files will be missing. How can I let a child package fail (because a file is missing) but let the rest of the parent package keep on running? I've tried increasi...

SQL Server Replication between availability zones on EC2

I was curious if anyone has had any experience doing this and what the approach and results were. We're currently investigating replication between availability zones to maximize uptime. Has anyone done this with success? Any guidelines or potential problems you could share with the community? ...

How to force SSIS PackageEnd after OnError handler?

I want my SSIS package to stop completely after handling the first error. I have tasks that run in the Package OnError event handler, but then I want the package to exit. Unfortunately, I have not been able to get this to happen. Even worse, when I get a warning, since I don't have an OnWarning handler, it propagates up to OnError, wh...

Telling How Much Space SQLCE Tables are Using

Is there a way to get a record count or a space-used value for all the tables in a SQL Server Compact database file (SQL CE 3.5.1)? I saw this question, http://stackoverflow.com/questions/2075026/sql-server-compact-count-records-get-space-used-for-all-tables-in-database So perhaps another option would be, is there an easy way to move ...

SQL Server: A Grouping question that's annoying me

I've been working with SQL Server for the better part of a decade, and this grouping (or partitioning, or ranking...I'm not sure what the answer is!) one has me stumped. Feels like it should be an easy one, too. I'll generalize my problem: Let's say I have 3 employees (don't worry about them quitting or anything...there's always 3), a...

SQL results operation question

I know I missasked the question, and that's probably the reason I can't find the solution myself: How do I take a result in a stored procedure and and change the data such as if column1 = AAA then column1=Hello else if column1 = BBB then column1 = goodbye and have the data return with the new values? Thanks ...