sql-server-2005

same date time data in col

i have one table for some transaction did select customer name,startdatetime,enddatetime, i want to know only one record in a specific date time if any customer did transaction in same time or in little difference ...

Working with macrons in sql server 2005

I have a table whose schema is declare @tbl table(field varchar(20)) insert into @tbl select 'Pāo' union all select 'Paorum' union all select 'Some Pao' union all select 'Pao' If I want to search the record only on the macron, I am unable to do so select * from @tbl where field = 'Pāo' Output: field Pao Pao If I use like ope...

Is it possible to install SQL Server 2005 (enterprise edition) on Windows Server 2008?

Is it possible to install SQL Server 2005 (Enterprise Edition) on Windows Server 2008? ...

How to get a week's view history of the job i.e running from Autosys Job Schedular?

Hi All, SCENARIO: Previously Jobs are scheduled to run from SQL Server. In the SQL Server database the jobs ran as per their start times mentioned. All the operations such as stopping the running job,starting the job are done by right clicking on the job. View history for the job (status,starttime and endtime of the job) is done by ri...

Index was out of range. Must be non-negative and less than the size of the collection.

Hi, I get the index out of range exception when compiling my grid view to display a set of orders. It doesn't happen when I add a new row but it does occur when I try to delete or update a row. Any help is much appreciated. The designer is: <asp:GridView ID="GridView1" runat="server" ...

TSQL to find if logins have password same as loginname?

Hi I want to check if SQL logins have passwords same as thier login name. E.g. login name 'abc123' has password= 'abc123'. I need to do this for a security audit across many 2000 and 2005 servers. Is it possible to check using TSQL? Thanks in advance ...

Fluent NHibernate issue with nvarchar(max) and sql express 2005

I have recently updated from NH2.1 to the latest trunk build. I also upgraded to the latest source code of Fluent NHibernate. A new issue has been introduced which manifests as the following exception : System.Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. P...

Subtract minute from datatime in sql server 2005

Suppose I have a datetime field whose value is 2000-01-01 08:30:00 and a duration field whose value is say 00:15( meaning 15 minutes) If I subtract these two, I should get 2000-01-01 08:15:00 I am trying like SELECT DATEDIFF(minute, '00:15','2000-01-01 08:30:00'); But the output is 52595055. How can i get the desired result. N.B...

Optimizing delete for a table referenced by lots of foreign keys

I have a table Document that is referenced by a ton of other tables via foreign keys. I am trying to delete a Document record, and according to my execution plan, SQL Server is doing a clustered index scan on every one of the referencing tables. This is very painful. I thought having a FK automatically made an index on the FK fields? ...

Create GUID of Custom Format...

.NET Allows to create GUID in pre-determined format.. I want to create it with my custom format.. Is it possible?how? ...

Partitioning of the database in SQL Server 2005

My project modules are organized in such a way that I have to maintain following Database structure. I've 5 schemas, each containing 20 to 50 tables. Each schema is associated with one module of the project. All the tables that are used within more than one modules are kept in "COMMON" schema. Each module takes 2 to 5 months to finish....

Filter based on an aliased column name

I'm using SqlServer 2005 and I have a column that I named. The query is something like: SELECT id, CASE WHEN <snip extensive column definition> END AS myAlias FROM myTable WHERE myAlias IS NOT NULL However, this gives me the error: "Invalid column name 'myAlias'." Is there a way to get around this? In the past I've included the...

SQL Server Full text index size growing

I got a big table with around 10 million records. The table is part of full text index and the data contained in it is recreated daily. Now after recreating the data I rebuild the full text index using SQL: ALTER FULLTEXT INDEX ON [table1] START FULL POPULATION; The issue is that the folder containing full text index files size is gro...

Footprints SQL Server

What does it mean by footprints in SQL Server? here's a snippet from MSDN "reduce the lock footprint of expensive queries" LINK ...

T-SQL script or function that will get selected values from a comma delimited string

if i have a string with values like A,B,C,D,E,F, and i wanted to remove the last comma? is there a function or script i can use to do that? Thanks ...

Separate tables/databases for reporting and CRUD operations

Periodically users running reports are blocking users doing CRUD operations and causing time-outs. I'd like to create duplicate locations of the current tables for the report users. I was thinking of creating a job that backs-up my app's database, and restores it to a reporting database on the same server so that users running reports w...

Comma Delimited SQL string Need to separated

I have this string that i am getting from .net application A,B,C,D,E,F, I wanted to write a sql select statement like set @string = 'A,B,C,D,E,F' select * from tbl_test where tbl_test.code in (@string) This wont work in t-SQL because it is using the @string as one string it is not separating the values. Is there any ways i can do ...

Problem in using indexes with SQL Server 2005 and Hibernate

I've a problem with a query generated by Hibernate that do not uses an index. Access to database is made from Java using JTDS and server version is SQL Server 2005, latest service pack. The field is nullable and is a foreign key that, in some specific scenarios, could be completely null, column is indexed via a not clustered index but t...

Need help writing script to run profiler on the server.

I need to create a single trace file that spans several days for one of my databases. This server also restarts every night. I was told that I should create a script to start the trace every time the server starts but i've been having trouble finding information on just what my script should look like to accomplish what it needs to do....

Convert .NET Ticks to SQL Server DateTime

Hello all, I am saving in my DB a TimeSpan (from .NET) value as BIGINT in SQL Server (saving the Ticks property). I want to know how to convert this BIGINT value to a DATETIME value in SQL Server (not in .NET). Any ideas? Cheers EDIT: I am using NHibernate to map a TimeSpan property I have, and it persists the Ticks property. I use i...