sql-server-2000

NHibernate paging with SQL Server

折月煮酒 提交于 2019-12-29 05:18:08
问题 When using SetFirstResult(start) and SetMaxResults(count) methods to implement paging I've noticed that the generated query only does a select top count * from some_table and it does not take the start parameter into account or at least not at the database level. It seems that if I instruct NHibernate to execute the following query: var users = session.CreateCriteria<User>() .SetFirstResult(100) .SetMaxResults(5) .List<User>(); 105 records will transit between the database server and the

Rows to Columns in SQL Server 2000

馋奶兔 提交于 2019-12-29 01:42:26
问题 I have this.. IDProspecto | IDObservacionCustomer | Observacion --------------------------------------------------------- 2204078 | 275214 | 03/9 Hable con Claudia me informa que Roberto ya se termino le deje.. 2204078 | 294567 | 19/09 SOLICITAN LLAME MAÑANA A ALEJANDRO 2204078 | 295310 | 20/09 se envia mail a adrian 2204078 | 304102 | CIA SOLICITA NO INSTALE EQUIPO And I want to have this... idprospecto | observacion1 | observacion2 | observacion3 | observacion4 | observacionN --------------

SQL Server: How to make server check all its check constraints?

时间秒杀一切 提交于 2019-12-28 05:16:08
问题 It seems that some scripts generated by Enterprise Manager* (or not, it doesn't matter) created check constraints WITH NOCHECK . Now when anyone modifies the table, SQL Server is stumbling across failed check constraints, and throwing errors. Can i make SQL go through all its check constraints, and check them? Running: sp_msforeachtable 'ALTER TABLE ? CHECK CONSTRAINT all' only enables previously disabled check constraints, it doesn't actually check them. Footnotes * SQL Server 2000 回答1: DBCC

SQL Server: How to make server check all its check constraints?

给你一囗甜甜゛ 提交于 2019-12-28 05:16:07
问题 It seems that some scripts generated by Enterprise Manager* (or not, it doesn't matter) created check constraints WITH NOCHECK . Now when anyone modifies the table, SQL Server is stumbling across failed check constraints, and throwing errors. Can i make SQL go through all its check constraints, and check them? Running: sp_msforeachtable 'ALTER TABLE ? CHECK CONSTRAINT all' only enables previously disabled check constraints, it doesn't actually check them. Footnotes * SQL Server 2000 回答1: DBCC

SQL Server ROW_NUMBER() on SQL Server 2000?

烂漫一生 提交于 2019-12-28 04:14:09
问题 I have a query that allows me to get records from a database table by giving it a minimum and maximum limit. It goes like this: SELECT T1.CDUSUARIO, T1.DSALIAS, T1.DSNOMBRE_EMPRESA, T1.DSCARGO, T1.DSDIRECCION_CORREO, T1.CDUSUARIO_ADMINISTRADOR, T1.FEMODIFICACION FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY CDUSUARIO) as row FROM TBL_USUARIOS ) as T1 WHERE row > @limiteInf and row <= @limiteSup ORDER BY DSALIAS ASC; Now, it works like heaven on SQL Server 2005 and SQL Server 2008 but tried to

Restore a SQL Server 2000 backup on SQL Server 2012

帅比萌擦擦* 提交于 2019-12-28 04:00:49
问题 I have got following error message while restoring a backup from SQL Server 2000 to the latest version. I do not know the old version, now I am using SQL Server 2012 (11.0.3128.0). The error message is: Msg 3169, Level 16, State 1, Server FF101, Line 1 The database was backed up on a server running version 8.00.0760. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the backup, or use a backup that is

Stored procedure throws error in SQL Server 2012 but works fine in SQL Server 2000

与世无争的帅哥 提交于 2019-12-25 18:11:29
问题 I have a stored procedure that works fine in SQL Server 2000 but throws an error on SQL Server 2012 Express where we are moving the DB to. [SQLServer JDBC Driver][SQLServer]The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns. Anybody able to help me sorting this out? CREATE PROCEDURE spSelectTopCourses AS declare @divisor int declare @column int set @column = 6 -- number of columns in the site

Is this a good or bad way of generating random numbers for each record?

风流意气都作罢 提交于 2019-12-25 07:26:34
问题 A colleague of mine discovered a behaviour in SQL Server which I was unaware of. CREATE VIEW dbo.vRandNumber AS SELECT RAND() as RandNumber GO CREATE FUNCTION dbo.RandNumber() RETURNS float AS RETURN (SELECT RandNumber FROM vRandNumber) GO DECLARE @mytable TABLE (id INT) INSERT INTO @mytable SELECT 1 INSERT INTO @mytable SELECT 2 INSERT INTO @mytable SELECT 3 SELECT *, dbo.RandNumber() FROM @mytable This seems to be the quickest way of generating a 'random' value for each record in a data set

Help refactoring an SQL query

本小妞迷上赌 提交于 2019-12-25 05:51:14
问题 Below is my SQL Query which takes more than 10 minutes and still running.... select DISTINCT Auditdata.ID,ns.ProviderMaster_ID as CDRComment from Auditdata AuditData inner join AuditMaster am on am.ID=AuditData.AuditMaster_ID inner join HomeCircleMaster hcm on hcm.Ori_CircleMaster_ID=am.CircleMaster_ID and hcm.Ori_ServiceTypeMaster_ID=1 and hcm.Dest_ServiceTypeMaster_ID=1 inner join NoSeriesMaster ns on (ns.CircleMaster_ID=am.CircleMaster_ID or ns.CircleMaster_ID=hcm.Dest_CircleMaster_ID) and

How to run a different query based on the day of week

冷暖自知 提交于 2019-12-25 03:48:29
问题 I have a program that autoruns with Windows scheduler. This program runs a stored procedure which uses Yesterdays date, to run a query against our database to pull results from the previous day. This query EXCLUDES a specific time period throughout the day as we do not care about those results. However, we have different hours on Sunday, and would like to change the query for Sunday... Is there a way to query differently if it's a "Sunday"? Below is my stored procedure: CREATE PROCEDURE [dbo]