sql-server-2005

SQL Server 2005 Memory Pressure and tempdb writes problem

元气小坏坏 提交于 2020-01-31 03:31:47
问题 We are having some issues with our production SQL Server. Server: Dual Quad Core Xeon 8 GB RAM Single RAID 10 Array Windows 2003 Server 64-bit SQL Server 2005 Standard 64-Bit There is about 250MB of free RAM on the machine right now. SQL Server has around 6GB of RAM, and our monitoring software says that only half of the SQL Server allocated RAM is actually being used. Our main database is approximately 20GB, with about 12GB being used with any frequency. Our tempdb is at 700MB. Both are

SQL Server Tree Hierarchy and Nested Sets with Duplicate Record ids

两盒软妹~` 提交于 2020-01-30 05:56:08
问题 Given that I have this resultset structure (superfluous fields have been stripped) Id | ParentId | Name | Depth ---------------------------- is it possible to have the records returned in tree order i.e. Parent then Children , if a Child is a Parent , then their Children , if not then Sibling , etc? For example, Id | ParentId | Name | Depth ---------------------------- 1 NULL Major 1 2 1 Minor 2 3 1 Minor 2 4 3 Build 3 5 3 Build 3 6 1 Minor 2 /* etc, etc */ The only way that I can think of

How can I add exactly 1 millisecond?

不羁岁月 提交于 2020-01-30 05:05:16
问题 select getdate(),DATEADD(millisecond,1,getdate()) yields me same answer....How to add exactly 1 millisecond? I cannot use a datetime2 field. 回答1: You'll need to store milliseconds separately if you need that much accuracy. In SQL Server 2005 there is no native date/time type that will allow you to be more precise than ~3 ms. This is why, for example, the last time you can have in a day is 23:59:59.997, not .998 or .999. 回答2: You can't. The accuracy of datetime is 3.33 milliseconds. Date and

How can I add exactly 1 millisecond?

依然范特西╮ 提交于 2020-01-30 05:04:35
问题 select getdate(),DATEADD(millisecond,1,getdate()) yields me same answer....How to add exactly 1 millisecond? I cannot use a datetime2 field. 回答1: You'll need to store milliseconds separately if you need that much accuracy. In SQL Server 2005 there is no native date/time type that will allow you to be more precise than ~3 ms. This is why, for example, the last time you can have in a day is 23:59:59.997, not .998 or .999. 回答2: You can't. The accuracy of datetime is 3.33 milliseconds. Date and

C# Prepared Statements - @ sign (at / strudel sign) queries

南笙酒味 提交于 2020-01-29 12:33:45
问题 I Have a problem with a prepared statement in C#: OdbcCommand cmd = sql.CreateCommand(); cmd.CommandText = "SELECT UNIQUE_ID FROM userdetails WHERE USER_ID = ?"; cmd.Parameters.Add("@USER_ID", OdbcType.VarChar, 250).Value = email; (of course email contains a valid email address, with @ sign). This code returns a random error - "The connection has been disabled" {"ERROR [01000] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionWrite (send()). ERROR [08S01] [Microsoft][ODBC SQL

C# Prepared Statements - @ sign (at / strudel sign) queries

柔情痞子 提交于 2020-01-29 12:32:35
问题 I Have a problem with a prepared statement in C#: OdbcCommand cmd = sql.CreateCommand(); cmd.CommandText = "SELECT UNIQUE_ID FROM userdetails WHERE USER_ID = ?"; cmd.Parameters.Add("@USER_ID", OdbcType.VarChar, 250).Value = email; (of course email contains a valid email address, with @ sign). This code returns a random error - "The connection has been disabled" {"ERROR [01000] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionWrite (send()). ERROR [08S01] [Microsoft][ODBC SQL

How to call C# function in stored procedure

喜你入骨 提交于 2020-01-29 05:12:48
问题 SQL Server 2005 supports CLR so it means we can use CLR in backend so how to do that, I have some function in c# which do some complex manipulation with date-time variable now I want to use those functions in SP. First of all IS IT POSSIBLE TO DO THIS. 回答1: Yes, it is possible to use .NET in a SQL Server 2005 database. Be aware that the .NET version supported by SQL Server 2005 is 2.0. Here's a link for an introduction to Making a CLR stored procedure using Visual Studio 回答2: Take a look this

How to call C# function in stored procedure

一曲冷凌霜 提交于 2020-01-29 05:12:25
问题 SQL Server 2005 supports CLR so it means we can use CLR in backend so how to do that, I have some function in c# which do some complex manipulation with date-time variable now I want to use those functions in SP. First of all IS IT POSSIBLE TO DO THIS. 回答1: Yes, it is possible to use .NET in a SQL Server 2005 database. Be aware that the .NET version supported by SQL Server 2005 is 2.0. Here's a link for an introduction to Making a CLR stored procedure using Visual Studio 回答2: Take a look this

Export table data from one SQL Server to another

泄露秘密 提交于 2020-01-27 03:21:48
问题 I have two SQL Servers (both 2005 version). I want to migrate several tables from one to another. I have tried: On source server I have right clicked on the database, selected Tasks/Generate scripts . The problem is that under Table/View options there is no Script data option. Then I used Script Table As/Create script to generate SQL files in order to create the tables on my destination server. But I still need all the data. Then I tried using: SELECT * INTO [destination server].[destination

Modify update statement includes primary key in trigger

偶尔善良 提交于 2020-01-25 23:48:09
问题 I'm working with a product that is creating update statements that include the primary key of the table. Simplified: UPDATE T SET PK1='ID1', PK2='ID2'... WHERE PK='ID1' AND PK2 ='ID2'... Running that statement will violate the primary key constraint. If run the same update without the PK1='ID1' in the SET the update runs without issue. How can I make this work? Instead of update trigger? I do not have any control over the product that is creating these statements. INFO There is one other