sql-server

Migrating an ERP product to SQL 2008 (regular or R2) from 2000.

We are running a version behind the latest for our ERP system which runs on SQL Server 2000. My version is not supported on 2008 (regular or R2). In fact, the latest version of the ERP is not certified to work with R2 (which isn't surprising since it hasn't been released yet) I have done some preliminary testing with 2008 and it appears...

How do I quickly explore objects in SQL Server Management Studio

Using SSMS Object Explorer to click through explorer tree against a database with many tables, stored procedures, views, ... can be time consuming, and inefficient way to gain access to specific objects while developing. Are there any tools to allow for quick access to objects? ...

Easy plugin or procedure for sqlserver Management Studio to script row inserts.

I've never been able to find a good script or plugin for sql server Management Studio (2005 and or 2008) for a very common scripting need: specifying a few/all rows in a table and scripting their insert. You can guess my story: I've got some configuration data in my dev db and I need to script it for deployment to UAT and then product...

How can I get SQL Server transactions to use record-level locks?

We have an application that was originally written as a desktop app, lo these many years ago. It starts a transaction whenever you open an edit screen, and commits if you click OK, or rolls back if you click Cancel. This worked okay for a desktop app, but now we're trying to move to ADO.NET and SQL Server, and the long-running transactio...

Pass a variable into a trigger

I have a trigger which deals with some data for logging purposes like so: CREATE TRIGGER trgDataUpdated ON tblData FOR UPDATE AS BEGIN INSERT INTO tblLog ( ParentID, OldValue, NewValue, UserID ) SELECT deleted.ParentID, deleted.Value, inserted.Value, @intUserID -- how can I pass this in? FROM inserted IN...

What are the reasons to use SQL Server instead of MySQL with a complex .Net project?

We currently have a 10 year old nasty, spaghetti-code-style SQL Server database that we are soon looking to pretty much re-write from scratch as part of a re-write to a large web application. (The existing application will serve as the functional requirements for the next incarnation of the app) The new version will be developed in .Net,...

the server principal is not able to acces sthe database under the current security context when attaching database

I'm trying to attach a database to a server, and i'm getting the following error: "the server principal XXX is not able to acces sthe database YYY under the current security context" I'm supposed to be the SA on the server, any ideas why i'm getting this? ...

Microsoft SQL Server 2005 time of day data type

Is there a data type which represents time of day? Such as a datetime data type without the date. when i format 41 seconds into a datetime data type this is what I get: 1/1/1900 12:00:41 AM I'm trying to store a duration of time in a table. ...

Database.ExecuteNonQuery does not return

I have a very odd issue. When I execute a specific database stored procedure from C# using SqlCommand.ExecuteNonQuery, my stored procedure is never executed. Furthermore, SQL Profiler does not register the command at all. I do not receive a command timeout, and no exeception is thrown. The weirdest thing is that this code has worked fi...

sql server optional parameters: syntax for between clause

@FromDate datetime = null @ToDate datetime = null SELECT * FROM TABLE WHERE .... AND [PI].Date BETWEEN @FromDate AND @ToDate When any date is null, the records are not displayed. What is the correct syntax so that I can get all records if any of the dates are null. I have thought of this: @FromDate datetime = '01/01/1901', @ToDate d...

Performance problem on a query.

Hi, I have a performance problem on a query. First table is a Customer table which has millions records in it. Customer table has a column of email address and some other information about customer. Second table is a CommunicationInfo table which contains just Email addresses. And What I want in here is; how many times the email ad...

Help with a query

Hi Based on the following table ID Effort Name ------------------------- 1 1 A 2 1 A 3 8 A 4 10 B 5 4 B 6 1 B 7 10 C 8 3 C 9 30 C I want to check if the total effort against a name is...

world countres list with cities

is there any solution to show user all countries and after select country it reselect all cities of its country? be best with script selecting p.s. russian name of countries ...

"Cleanly" Deploying an ASP.NET Application with LINQ to SQL Server

In my development environment, my SQL Server is PHILIP\SQLEXPRESS. In testing, it's ANNIE, and the live environment will have a third name yet to be determined. I would have assumed that updating the following statement in web.config would have been enough: <add name="MyConnectionString"providerName="System.Data.SqlClient" connectionSt...

SQL Better performance: char(10) and trim or varchar(10)

I have a database that uses codes. Each code can be anywhere from two characters to ten characters long. In MS SQL Server, is it better for performance to use char(10) for these codes and RTRIM them as they come in, or should I use varchar(10) and not have to worry about trimming the extra whitespace? I need to get rid of the whitespace...

Execute SQL Task error -

I get the following error when I call a stored proc within an execute sql task in SSIS. "Description: Executing the query "Exec up_CallXXX" failed with the following error: "Incorrect syntax near '13'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection ...

Can I call a UDF at Frontend

I have a UDF in sql server. I want to call this function at frontend (C# Code). Is it possible to do it. ...

If I update a view, will my original tables get updated

suppose I have tables Employee, Locations. and I have a view viewEmpLocation which is made by joining Employee and Locations. Now If I update the view, will data in original table get updated. ...

asp.net Dynamic Data Site and SQL Server image datatype

I'm just now created Dynamic Data Entities Web Site. And I have got a problem with image type. for all sql data types generated html elements by fieldTemplate. So, how can I create fieldtemplate for image-view, and image-upload ? ...

Microsoft SQL Server 2005 - using the modulo operator

So I have a silly problem, I have not used much SQL Server before, or any SQL for that matter. I basically have a minor mathematical problem that I need solved, and I thought modulo would be good. I have a number of dates in the database, but I need them be rounded off to the closest [dynamic integer] (could be anything from 0 to 500000...