sql-server-2008

How to encrypt all existing stored procedures of a database

Is there any possibility to encrypt all existing stored procedures of a SQL Server 2008 database AFTER they have been created via an SQLCMD script? The reason I want to do this is the following: I'd like to develop the stored procedures without encryption so I can easily click on "Modify" in SQL Server Management Studio to check their c...

SQL Server 2008 Intellisense - Typing 'top' brings up tables, causes confusion

Hey everyone, SQL Server 2008 introduced Intellisense while writing queries. Problem is, whenever I type in "SELECT TOP" and press space, it replaces TOP with a table named 'Top3_Animations'... Is there a way to add "TOP" to the Intellisense list? Or to fix this some other way? Bara ...

intermittent problem occurring with a table that is only used for selection

I have a database running on SQL Server 2008. An exception throws when any statement refers to one specific table called 'stop': Msg 6533, Level 16, State 48, Line 1 AppDomain mssqlsystemresource.sys[runtime].12171 was unloaded by escalation policy to ensure the consistency of your application. Out of memory happened while accessing a c...

SQL Server 2008 Replication (avoiding reinitialization)

I'm trying to determine if there's a better way to handle replication than the way we're currently doing things. We're essentially trying to determine 2 things: Is there any way to add an existing column from a table to replication without reinitializing the whole publication Can you just select a specific article to reinit...

SQL Server 2008 Sync - How to reinsert conflicting pk rows with new primary key

Can someone point me in the right direction for handling a PK conflict error in c# .net using Sync Framework. I am trying to sync between sql server 2008 and local data cache database (.sdf) and would like to keep BOTH rows that are conflicting in both server and client and NOT allow either the server or client win? I get a pk confli...

Generating XML file from SQL Server 2008

Hi, I am working on an application where I need to get the SQL response as XML into an XML file (and to store it in some physical location, say c:\xyz.xml). I am able to generate the XML content using the provisions available in SQL Server as shown below. SELECT * FROM @Table FOR XML AUTO, ELEMENTS where: @Table is a table vari...

SQL Server 2008 filtered indexes

Hi ! I'd like to understand the SQL Server 2008 Filtered Index Feature. How does the Database Engine deal wih this concept ? And how is it going to help me get faster results than standard indexes while querying large tables ? Can anybody help me on this ? Thanks. ...

How do you concatenate strings inside of a CONTAINS in SQL Server 2008?

SQL Server 2008 is telling me that it doesn't like the "+" in the CONTAINS. Not sure what I'm doing wrong here. INSERT INTO dbo.tblImportTitles ( ImportTitleGUID, UserGUID, TitleName, TitleGUID ) SELECT ImportTitleGUID = T.Item.value('@ImportTitleGUID', 'uniqueidentifier'), UserGUID = T.Item.value('@UserGUID', 'u...

Can I select all the tables with more than one update trigger

Can I select all the tables with more than one update trigger? The following code selects all the tables with more than one trigger, but I need only the tables with more than one update trigger. This query also returns tables with one insert trigger and one update one, which is not what I want. SELECT * FROM sys.triggers WHERE parent_id...

Finding Occurrences In The Future, Periods And Start Dates

Okay, I'll simplify this post. I have a table "tasks" containing, for example, a task name, the date it starts, and a frequency. Based on these fields I need to be able to specify a date range and return each occurrence of that task for when it's due. For example, if I have a task with the frequency of M (for monthly) and my date rang...

error executing sql server query

Hi Guys, I am getting an error using this query select dbresultsid, TestCase, BuildID, Analyzed, Verdict, (select count(Verdict) from results where BuildID = 'Beta1' and Verdict = 'PASS') AS PASS, (select count(Verdict) from results where BuildID = 'Beta1' and Verdict = 'FAIL') AS FAIL, ...

difference in these queries

Hi, I am executing a query different way in MSSQL, but the second query is not giving result as the first one. Query 1: select dbresultsid, TestCase, BuildID, Analyzed, Verdict, (select count(Verdict) from results where BuildID = 'Beta1' and Verdict = 'PASS') AS PASS, (select count(Ver...

optional parameters in SQL Server stored proc?

Hi everyone, I'm writing some stored procs in SQL Server 2008, and wondered if the concept of optional input parameters is possible here? I suppose I could always pass in NULL for parameters I don't want to use, check the value in the stored proc, then take things from there, but I was interested if the concept is available here. Th...

SQL Server 2008 CTE And CONTAINSTABLE Statement - Why the error?

I am testing out moving our database from SQL Server 2005 to 2008. We use CTE's for paging. When using full-text CONTAINSTABLE, the CTE will not run and generates an error. Here's my non-working code- WITH results AS ( SELECT ROW_NUMBER() over (ORDER BY GBU.CreateDate DESC ) as rowNum, GBU.UserID, NULL AS DistanceInMi...

What is the point of "ROLLBACK TRANSACTION named_transaction"?

I've read through MSDN on ROLLBACK TRANSACTION and nesting transactions. While I see the point of ROLLBACK TRANSACTION savepointname, I do not understand ROLLBACK TRANSACTION transactionname. It only works when transactionname is the outermost transaction ROLLBACK always rolls back the entire transaction "stack", except in the case ...

How to Insert Records based on the Previous Insert?

Here's my procedure: PROCEDURE add_values AS BEGIN INSERT INTO TABLE_A ... SELECT t.id, t.name FROM TABLE_C ("This selection will return multiple records") END While it inserts in TableA, I would like insert into another table(TableB) for that particular record which got inserted in tableA. The columns in TableA and TableB ar...

Is it wiser to use a function in between First and Next Insertions based on Select?

PROCEDURE add_values AS BEGIN INSERT INTO TableA SELECT id, name FROM TableC ("This selection will return multiple records") While it inserts in TableA i would like insert into another table(TableB) for that particular record which got inserted in tableA Note:The columns in TableA and TableB are different , is ...

Visual Studio 2008/2010 & SQL Server 2008 on Windows 7 Home Premium

Are there any limitations with respect to developing ASP.NET and WPF apps using VS 2008/2010 and SQL Server 2008 on Windows 7 Home Premium? I know you can run IIS 7.5 on Home Premium. I Googled and Binged on Home Premium and VS/SQL Server and couldn't find much. It doesn't look like the features missing from Home Premium, domain joinin...

how to create image from gis data in C#

I'm using C# to pull spatial data from a sql server 2008 database. I'm then trying to perform operations on that data, but to start... I want to be able to visualize it. That is, I would like to create an image of the data, preferably in jpg format. I thought that I might do it by hand, but that is proving more challenging than I ha...

SQL Design: Big table, thread access serialization.

Hi there. I have one BIG table(90k rows, size cca 60mb) which holds info about free rooms capacities for about 50 hotels. This table has very few updates/inserts per hour. My application sends async requests to this(and joined tables) at max 30 times per sec. When i start 30 threads(with default AppPool class at .NET 3.5 C#) at one tim...