sql-server

Trigger on Select

I want to return different results to user when using Select because it returns wrong value and i cant use view or something else because its third party appliction. I want to make instead of his select perform another select trigger or any thing else. ...

MVC Logon just refreshes page - doesn't log on

Hi I have 2 MVC sites on a shared hosting environment. The first one works fine and I can log on and use the membership provider etc.. no problems. A second site can see the database and retrieve other (site specific) data on its pages. However when I try to log in I simply get a page refresh - no error messages with invalid UC/PW, and n...

Comparing Time in SQL Server 2008

Here is my table. I need a query which returns the shift id for a specified time How can I get the value? shift_ID shift_From shift_To 1 2010-09-21 10:00:00.000 2010-09-21 18:10:00.000 2 2010-09-21 20:00:00.000 2010-09-21 05:00:00.000 Suppose I am giving 02:00:00 as input I need to get the shift ...

How to make software developed in WinForms .NET 3.5 with SQL Express portable

i found that its really pain to create setup and deployment packages for windows xp/vista/7 so my question is can i make my application portable with any third party tool such as thin app ? my application requires dot net 3.5 framework and sql express 05 installed i want to put it on usb drive and user can execute it directly from usb...

Create computed column with string in formula

I want to create a computed column in SQL SERVER and set the formula to this ([Category] + '.aspx?ID=' + [Post_ID]) Not working though......what am i missing? Category and Post_ID are current columns in the table ...

Can I stop sp_reset_connection being called to improve performance?

My profiler trace shows that exec sp_reset_connection is being called between every sql batch or procedure call. There are reasons for it, but can I prevent it from being called, if I'm confident that it's unnecessary, to improve performance? UPDATE: The reason I imagine this could improve performance is twofold: SQL Server doesn't n...

Updating a column with concatenated value

I have an id field (int type) and varchar field. I have to concatenate both columns and store the result to another column with data type nvarchar; Is this possible? ...

asp.net 4 mvc 2 error

Hi, when I run the app on server I get: Could not load file or assembly 'Microsoft.SqlServer.Replication.DLL' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1) Description: An unhan...

How to downgrade from SQL Server Express 2008 to SQL Server Express 2005?

Hi friends, I was using Visual Studio 2008, and I use service based database, then one day I installed Visual Studio C# Express 2010, which automatically upgraded my SQL Server the 2008 Express edition. But I want to use Visual Studio 2008, but it does not support SQL Server 2008. So, please give me the method to downgrade from SQL Ser...

All possible combinations for two column data

I have a two column view Product Id Tag ---------------------- 1 Leather 1 Watch 2 Red 2 Necklace 2 Pearl I'm trying to get all possible combinations of tags for a product as such: 1 Leather 1 Leather,Watch 2 Pearl 2 Pearl,Necklace 2 ...

How to set timeout for a stored procedure in SQL Server

I have a stored procedure in SQL Server, I want to set a time out for my sprpc so that if it does not finish in appropriate time, SQL Server forces it to stop. thanks ...

Strange Sql Server Query Slow

i have a query like this SELECT TOP 10 * FROM NEWS WHERE newsid > AAA ORDER BY newsid desc; this query is very slow for some values of AAA for example it is fast for 1,000,000 and 1,400,000 but it is slow for 1,355,316 I am confused!!! ...

Is there a refactoring tool for SQL Server Database

Hi I would like to know if does anybody know a freeware refactoring tool, in which I could rename some table columns and get those names also renamed in my stored procedures. Does it exist? ...

SQL Server table-relations necessary with NHibernate?

Dear All! This may be a really silly question, but I've found no answer on google/bing... If I already use NHibernate for persistence with SQL Server, why should I then create all the table-relations on the database-schema? I'm just wondering because it seems to create all the relations, altough I already have defined them in the NHibe...

SQL Server Schema Design

I have several Products - Plants relationships that I need to create tables in SQL SERVER. A product (around 8000) is manufactured in all 8 Plants but rarely (3-4 products out of 8000) a Product is manufactured in one/two Plants. I am thinking to implement relation-ship in either of two ways. (I know 1st approach is better but 2nd appro...

Silverlight 4.0 using WCF to connect to SQL server

Hi, Is it good idea to use WCF to connect to SQL server in my silverlight application? This communication layer deals only with the database (SQL Server) and will return a large dataset most of the time. I am trying to speed up my silverlight application. I was using aspx pages and the client wants something flashier and faster. Any r...

Upgrade Path For Legacy Reporting ("Embedded" Access 2003)?

Update: Albert D. Kallal has kindly started the discussion off, and to get some more opinions I'm adding a bounty. This is a nontrivial question about maintenance of a legacy application myself and two other developers support. We are not the original developers, and the code base is 300,000 lines of MFC and business logic tightly co...

Efficient way to fetch the total number of records in SQL server during Paging

When querying a table in sql server, im trying to fetch only the current page of records. However I need the total number of records that would be returned for the particular query to calculate the number of pages. How to do this efficiently without writing another query to count the records. WITH allentities AS (SELECT Row_...

SQL Server transactions / concurrency confusion - must you always use table hints?

When you create a SQL Server transaction, what gets locked if you do not specify a table hint? In order to lock something, must you always use a table hint? Can you lock rows/tables outside of transactions (i.e. in ordinary queries)? I understand the concept of locking and why you'd want to use it, I'm just not sure about how to implemen...

When I add or derive columns, subsequent data flow transformations don't see the new columns

Is there a way to "cascade" new column information down through the subsequent data flow transformations when I add a new column? My current practice is to open each tranformation in sequence and verify that the new column is available. If it isn't, I delete and recreate the transformation. I can't believe there isn't a better way to ...