sql-server-2005

How do I find the data directory for a SQL Server instance?

冷暖自知 提交于 2019-12-28 03:29:05
问题 We have a few huge databases (20GB+) which mostly contain static lookup data. Because our application executes joins against tables in these databases, they have to be part of each developers local SQL Server (i.e. they can't be hosted on a central, shared database server). We plan on copying a canonical set of the actual SQL Server database files (*.mdf and *.ldf) and attach them to each developer's local database. What's the best way to find out the local SQL Server instance's data

No Support for OVER in MS SQL Server 2005?

只谈情不闲聊 提交于 2019-12-28 03:11:26
问题 OVERI am getting an error when trying to run a query in MS SQL Server Management Studio. We use MS SQL Server 2005 on a windows 2003 server. Here is the query: WITH q AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY dbo.[1_MAIN - Contacts].Contact_ID ORDER BY dbo.[1_MAIN - Contacts].Contact_ID) AS rn FROM dbo.[1_MAIN - Contacts] INNER JOIN dbo.Referral ON dbo.[1_MAIN - Contacts].Contact_ID = dbo.Referral.Referral_ID INNER JOIN dbo.prov_training_records ON dbo.[1_MAIN - Contacts].Contact_ID =

How should I multiple insert multiple records?

强颜欢笑 提交于 2019-12-28 01:55:09
问题 I have a class named Entry declared like this: class Entry{ string Id {get;set;} string Name {get;set;} } and then a method that will accept multiple such Entry objects for insertion into the database using ADO.NET: static void InsertEntries(IEnumerable<Entry> entries){ //build a SqlCommand object using(SqlCommand cmd = new SqlCommand()){ ... const string refcmdText = "INSERT INTO Entries (id, name) VALUES (@id{0},@name{0});"; int count = 0; string query = string.Empty; //build a large query

How can I determine the status of a job?

旧城冷巷雨未停 提交于 2019-12-28 01:53:07
问题 I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job. Below details would help me 1) How to see the list of all jobs that have got scheduled for a future time and are yet to start 2) How to see the the list of jobs running and the time span from when they are running 3) How to see if the job has completed successfully or has stoped in between because of any error. 回答1: You could try

varbinary to string on SQL Server

泄露秘密 提交于 2019-12-27 13:57:52
问题 How to convert a column value from varbinary(max) to varchar in human-readable form? 回答1: "Converting a varbinary to a varchar " can mean different things. If the varbinary is the binary representation of a string in SQL Server (for example returned by casting to varbinary directly or from the DecryptByPassPhrase or DECOMPRESS functions) you can just CAST it declare @b varbinary(max) set @b = 0x5468697320697320612074657374 select cast(@b as varchar(max)) /*Returns "This is a test"*/ This is

SQL server select distinct rows using most recent value only

扶醉桌前 提交于 2019-12-27 12:23:11
问题 I have a table that has the following columns Id ForeignKeyId AttributeName AttributeValue Created Some of the data may look like this: 1, 1, 'EmailPreference', 'Text', 1/1/2010 2, 1, 'EmailPreference', 'Html', 1/3/2010 3, 1, 'EmailPreference', 'Text', 1/10/2010 4, 2, 'EmailPreference', 'Text', 1/2/2010 5, 2, 'EmailPreference', 'Html', 1/8/2010 I'd like to run a query that pulls the most recent value of the AttributeValue column for each distinct ForeignKeyId andAttributeName, using the

SQL server select distinct rows using most recent value only

蓝咒 提交于 2019-12-27 12:22:21
问题 I have a table that has the following columns Id ForeignKeyId AttributeName AttributeValue Created Some of the data may look like this: 1, 1, 'EmailPreference', 'Text', 1/1/2010 2, 1, 'EmailPreference', 'Html', 1/3/2010 3, 1, 'EmailPreference', 'Text', 1/10/2010 4, 2, 'EmailPreference', 'Text', 1/2/2010 5, 2, 'EmailPreference', 'Html', 1/8/2010 I'd like to run a query that pulls the most recent value of the AttributeValue column for each distinct ForeignKeyId andAttributeName, using the

SQL Server, convert a named instance to default instance?

旧街凉风 提交于 2019-12-27 11:37:05
问题 I need to convert a named instance of SQL server 2005, to a default instance. Is there a way to do this without a reinstall? The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for the path of least resistance to getting these 2 back on to our teams standard setup. Each has expressed that this is going to be, too much trouble and that it will take away from their development time.

SQL Server, convert a named instance to default instance?

两盒软妹~` 提交于 2019-12-27 11:35:22
问题 I need to convert a named instance of SQL server 2005, to a default instance. Is there a way to do this without a reinstall? The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for the path of least resistance to getting these 2 back on to our teams standard setup. Each has expressed that this is going to be, too much trouble and that it will take away from their development time.

Error inserting date and time in SQL Server 2005 datetime c#? [closed]

不羁的心 提交于 2019-12-25 21:04:14
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Problem saving to SQL Server 2005: cmd = new SqlCommand("INSERT into survey_Request1(sur_no,sur_custname,sur_address,sur_emp,sur_date,sur_time,Sur_status)values(" + "'" + textBox9.Text + "'" + "," + "'" +