SqlServer 2000 开发问题
1.NULL永不=NULL .如何设置让 NULL=NULL呢? declare @tab table (id int ) insert into @tab select 1 select * from @tab where null = null 问题解决: 比较前用 set ANSI_NULLS off ,别忘了比较完后再设置为原来的默认值.:) set ANSI_NULLS on 2.分布式事
1.NULL永不=NULL .如何设置让 NULL=NULL呢?
declare @tab table (id int )
insert into @tab select 1
select * from @tab where null = null
问题解决: 比较前用 set ANSI_NULLS off ,别忘了比较完后再设置为原来的默认值.:) set ANSI_NULLS on
2.分布式事务总是出错.
现象:
begin tran
select * from [192.168.1.100].aigdollar.dbo.shoporderinfo
commit
该操作未能执行,因为 OLE DB 提供程序 'SQLOLEDB' 无法启动分布式事务。
[OLE/DB provider returned message: 新事务不能登记到指定的事务处理器中。 ]
问题解决:
打开MSDTC的安全配置,选中:
网络DTC访问.
允许入站.
允许出站.
不要求进行验证.
启用事务 Ineternet 事务 (TIP事务).
启用 XA 事务.
DTC登录帐户: NT Authority\NetworkService
防火墙打开 135 端口( RPC ),允许 MSDTC ( 或打开1885 端口).
OK!
微软资料: http://support.microsoft.com/kb/Q899191
3.如何在SQL-Server的系统表中找出主键而非索引?
下列代码只能找出索引:
CREATE TABLE [abc] (
[id] [int] NOT NULL ,
[con] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
CONSTRAINT [PK_abc] PRIMARY KEY NONCLUSTERED
(
[id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE UNIQUE CLUSTERED INDEX [ic] ON [dbo].[abc]([con]) ON [PRIMARY]
GO
select object_name(id),*
from dbo.sysindexkeys
where object_name(id)='abc'
问题解决:
http://www.itdb.cn/n/200605/22/n20060522_6914.shtml
分析晕了.呵呵.分析后关键代码是这样的.
select * from sysobjects where parent_obj = object_id('abc')
select * from sysindexes where id = object_id('abc')
select * from sysindexkeys where id = object_id('abc')
所以下面这样是有道理的.
SELECT *
FROM syscolumns as Col join sysobjects as Obj on ( Col.id = Obj.parent_obj )
WHERE (Obj.xtype = 'PK')
and Obj.parent_obj = object_id('abc')
and Obj.name IN
(
SELECT name
FROM sysindexes as ix
WHERE ix.id = object_id('abc') AND ix.indid IN
(
SELECT indid
FROM sysindexkeys as ik
WHERE (id = object_id('abc') ) AND ik.colid IN
(
SELECT colid
FROM syscolumns as col2
WHERE col2.id = object_id('abc') AND col2.name = Col.name
)
)
)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

SQL Server database files are usually stored in the following default location: Windows: C:\Program Files\Microsoft SQL Server\MSSQL\DATALinux: /var/opt/mssql/data The database file location can be customized by modifying the database file path setting.

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

If the SQL Server installation fails, you can clean it up by following these steps: Uninstall SQL Server Delete registry keys Delete files and folders Restart the computer
