sql-server-2005

How to execute t-sql script using java?

I have found the following links for executing script using java i.e. http://stackoverflow.com/questions/2071682/how-to-execute-sql-script-file-in-java . But it is specific to postgre and mysql. I am looking for same solution for executing script in Sql server 2005. I am not acquinted with SQL Command Line. I have to make a batch conta...

Why Microsoft abandoned Notification Services in SQL Server 2008 ?

I invested quite a bit of time toying with NS introduced in SQL 2005 and found it to be excellent feature.. However , I hear MS has abandoned NS in 2008; Why ? and with what they are replacing it if any at all.. ...

SQL CLR - Does lock statement make any difference?

Hello All, I have written the following piece of code ( sql clr stored procedure ) that writes messages to a local file. The problem occurs when multiple connections call the stored proc at the same time. So I used a lock statement. But this doesn't seem to make any difference? What am I doing wrong here? lock (SqlContext.Pipe) { S...

SQL Server 2005. DateTime Comparision of two columns of same table

I am having a query, I had a table named tblBooking There exist 3 columns in that table Column Names BookingID StartTime EndTime Datatye int datetime datetime Sample data 1 10:00 11:00 2 11:00 12:00 3 01:30 03:30 I need to compare values of two columns StartTime EndTime Query is : I had to alloacte a resource eg. Meeting Room This can b...

T-SQL: Omit/Ignore repetitive data from a specific column

Hi, For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits 2                Apple                 5.00       Food 3                Orange               3.00       Fruits 4                Banana   ...

SQL Server Express 2005: How to import fixed width data using BCP

I’m trying to import fixed width data from text file into SQL Server Express using BCP. I have read some Microsoft’s web pages about this matter, but I haven’t got far with them. Can please give some examples or point to some good tutorials about this subject? ...

constraint Problem /Solution in sqlServer

Hi Sorry for my shallow question . Imagine I have 4 Tables in my DataBase (SQLServer 2005). Picture , News , product and gallery Tables . At my Picture Table i Have 3 foreign key to all 3 other tables , And all foreign keys are nullable and default value = -1 . All tables have Primary keys and is Identity . At my webform every ph...

SQL Server Hanging after Insert Into Select

Thanks for taking a look at this. The issue has to do with the following sql query. Basically it recursively finds all pages underneath a certain page(master page), and then applies the master page's categories(looked up in the xref_pages_categories) to all of those pages. Upon running the insert, querying the table for data that shoul...

Monitoring a calculated data (A person's age) in SQL Server

I have a table, tblClient, which stored a client's date of birth in a field of type datetime, DOB. The goal here is that, when a client reaches 65 years old (need to be calculated thru DOB), I need to insert a new record into another table. But since the age of a client does not change due to a database transaction (INSERT,UPDATE,DELET...

sql server network error

hi i am using sql server 2005 for my servlet jsp project, i am connecting it using jtds jdbc driver. the problem is it is working really good for 3 to 4 days but after that it throws error "Network Error IO Exception : Access Denied" unable to read file blah, blah .... then i have to detach the database and then attach it to mak...

SqlDependency query with WHERE clause not allowed. How can I modify it to be valid?

I have a SqlDependency set up using the following query: string sql = "SELECT dbo.Case.CMRID, dbo.Case.SolutionID, dbo.Case.CreateDT, dbo.Case.ModifyDT " + "FROM dbo.Case " + "WHERE dbo.Case.ModifyDT > '" + LastExecutionDateTime + "'"; Executing this query causes the OnChanged event to fire continuously with a type of Invalid and Sour...

sql server 2005 databse password recovery

i have one database in ms sql server 2005. i create this long time back, now want to modify it but i lost the password, i remember the user name for that database, is there any way to recover the password for that database or change its password ? Thanks ...

Why is using OPENQUERY on a local server bad?

I'm writing a script that is supposed to run around a bunch of servers and select a bunch of data out of them, including the local server. The SQL needed to SELECT the data I need is pretty complicated, so I'm writing sort of an ad-hoc view, and using an OPENQUERY statement to get the data, so ultimately I end up looping over a statement...

NHIbernate SysCache2 and SQLDependency problems

Hi, I've set enable_broker on my SQL Server 2008 to use SQLDepndency I've configured my .Net app to use Syscache2 with a cache region as follows: <syscache2> <cacheRegion name="BlogEntriesCacheRegion" priority="High"> <dependencies> <commands> <add name="BlogEntries" command="Sel...

EnumAvailableServers(false) of SMO in SQL 2008 cluster is returning zero records ??

Call to EnumAvailableServers(false) is reurning zero list of sql instances in the windows 2008 sp2 cluster having sql 2008 sp1 setup. Firewall was disabled.. What are the reasons for its failure?? ...

Elect one web application instance to perform a task triggered by an external event?

I have an ASP.NET application running on multiple IIS6 web servers, with a SQL Server 2005 database back-end. I need to: monitor the database for the completion of an external job event, and then have exactly one web application instance submit some information to a web service For (1) it seems like a SqlDependency would be the best...

a PRINT 'Success' that screw up a begin trans/ begin try commit / end try?

So I just saw a weird behavior In one script there is something like: begin transaction begin try stuff stuff stuff print 'commit' commit transaction end try begin catch print 'rollback' print error_message() rollback transaction end catch thing is when this script i...

Why would an Entity Framework model generator not create code for a table when I selected it?

I have Visual Studio 2008: I can create Entity Framework models on existing tables in a SQL Server 2005 database. I can create Entity Framework models on tables I create in a local SQL Server 2008 database files. However, when I add a new table to the SQL Server 2005 database, then try to create an Entity Framework model on it, it le...

Finding a single record in a table step-by-step by different requests

There is a table in a databse, let's call this table Document. This table has fields: MajorVersionNumber MinorVersionNumber ReleaseDate There are rules to determine the order of versions and their expiration dates. I'll give the rule of finding expiration date of a version in C# 3 because it looks more easy to read then in English. ...

SQL Server 2005 Express edition Output keyword syntax

I'm playing with the Output keyword in SQL Serer 2005 Express. I've written the following query: Declare @tempTable as Table(masterLotDB datetime) Insert into dbo.tblMasterLot (RecordCreation) Values ('2009-10-02') OUTPUT INSERTED.RecordCreation into @tempTable I get a syntax error of Msg 102, Level 15, State 1, Line 6 Incorrect syn...