sql-server

Making Microsoft Access Tables in SQL Server Identical on different setups

Hello all, I have just noticed that one of the views I create from Microsoft Access in SQL Server via a linked server is interpreted differently in different machines/setups etc. Example: EXEC sp_addlinkedserver acc465tghv, 'OLE DB Provider for Jet', 'Microsoft.Jet.OLEDB.4.0', 'C:\tester.mdb' EXEC sp_addlinkedsrvlogin acc465tghv, TRUE...

Considerations where to store documents - on file server or in DB?

I have a design decision to make regarding documents uploaded to my web site: I can either store them on my file server somewhere, or I can store them as a blob in my database (MSSQL 2005). If it makes any difference to the design decision, these documents are confidential and must have a certain degree of protection. The consideration...

Agent message code 20084. The process could not connect to Subscriber

All servers running SQL 2005 SQL server (NOLA) replicates to 35 remote locations (StoreXX). Earlier this week, one publication started having problems connecting to 30 of the 35 remote locations, with an error of: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Date 2/4/2010 10:00:01 AM Log Job History (NOLA-Closing_B...

NHibernate With SQL Server Full Text

How-tu use NHibernate (with Fluent NHibernate) with SQL Server Full Text Search ? Thanks ...

SQL Server Top 1

In Microsoft SQL Server 2005 or above, I would like to get the first row, and if there is no matching row, then return a row with default values. SELECT TOP 1 ID,Name FROM TableName UNION ALL SELECT 0,'' ORDER BY ID DESC This works, except that it returns two rows if there is data in the table, and 1 row if not. I'd like it to always...

Is there a way to hide a schema or at least the aspnet procedures from Sql Server Management Studio's proc list?

I think the question speaks for itself, but I'm sick of scrolling through my procedure list filled with 50 aspnet procedures. Is there a way to hide the dbo schema, or these procedures from the list? Is there a different/equivalent tool that would let me do this? With TOAD, I could open each schema independently - that'd be wonderfu...

SQL Server Reporting Services Round() function

Hi, there is some bizarre thing happening with my report generated in SQL Server Reporting Services and I hope I am not being too stupid. I use the Round function to get integers. Sometimes a 4.5 will round to 4 and a 5.5 will round to 6. Is this because of the rounding method? I am using this: Round(Fields!GroupAverageAssessment.Value,...

"Specified cast is not valid" error in C# windows forms program

I'm having a "Specified cast is not valid" error. Windows form application in C#. I'm trying to retrieve a value from a table. The value is either a smallint, or a numeric(i tried both fields, both give me the same error), and I try to store it in an int variable. here's the source: using (SqlDataReader rdr = cmd.ExecuteReader()) //"se...

SQL - Inserting and Updating Multiple Records at Once

I have a stored procedure that is responsible for inserting or updating multiple records at once. I want to perform this in my stored procedure for the sake of performance. This stored procedure takes in a comma-delimited list of permit IDs and a status. The permit IDs are stored in a variable called @PermitIDs. The status is stored in...

Designing dimension hierarchies: Natural or Unnatural

I'm using Analysis Services and when designing dimensions I'm never sure how far to go to build natural hierarchies. What I mean is I've added in all the genuine attribute relationships. So most hierarchies are natural anyway but the most commonly requested hierarchy is 3 or more levels with a middle level as a slowly changing attribut...

SQL Server Table Owner - change the default

Is there something in SQL Server similar to USE (to switch databases) that can control the owner prefix that is used for tables? For example, we have an application that insists on creating tables "theServiceAccount.TheTableName" ; What we really want is to force it to put the table names under dbo... so "dbo.TheTableName" . We don't ha...

Looking for a good Database Comparison Tool

Hey there. I'm looking for an App that will compare two databases and generate the appropriate scripts to upgrade one from the other (I'm using SQL Server 2008). My scenario is that I've built a fairly basic CMS a while ago, and just recently added several new features. I'd like to upgrade the 3 or 4 existing websites to the new syste...

Inserting rows into a table with multiple fields in the primary key, the last of which should autoincrement

I am storing price data events for financial instruments in a table. Since there can be more than one event for the same timestamp, the primary key to my table consists of the symbol, the timestamp, and an "order" field. When inserting a row, the order field should be zero if there are no other rows with the same timestamp and symbol. ...

SQL Server unique auto-increment column in the context of another column

Suppose the table with two columns: ParentEntityId int foreign key Number int ParentEntityId is a foreign key to another table. Number is a local identity, i.e. it is unique within single ParentEntityId. Uniqueness is easily achieved via unique key over these two columns. How to make Number be automatically incremented in the c...

Do DB locks require transactions?

Is it true that "Every statement (select/insert/delete/update) has an isolation level regardless of transactions"? I have a scenario in which I have set update of statements inside a transaction (ReadCommitted). And another set not in a transaction (select statements). In this case when first set is executing another waits. If I set R...

SQL Insert Query (syntax question)

I have an sql query which is working, it does insert the correct data, but the ID's are out of synch: Dim sql As String = ("INSERT INTO [CANRADcontacts]") & _ (" ([Title], [Initials], [FirstName], [LastName], [Organisation], [Department], [Address], [Code],") & _ (" [Telephone], [WorkTelephone], [Fax], [CellularTelephon...

Tool to retrieve binary jpg data from SQL Server

(Asking on behalf of a friend employed in a local bank) Since he's no programming experience (neither do I with SQL Server), he's looking for a tool which can show all the jpg images stored in a windows SQL Server database. Google didn't give any satisfactory result. ...

Is an operation in SQL guaranteed to be atomic if performed in a single update statement?

I'm trying to remove the need to explicitly lock a table with the following code but from reports I've been getting it may be possible that the parameter and value in the row are suffering from a race condition. Declare @NextNumber Int; Update MyParameterTable Set NextNumber = NextNumber + 1, @NextNumber = NextNumber + ...

Index view: How to choose the Clustered Index?

Hi folks, I'm going to do an indexed view, based on three tables with inner and outer joins between them (SQL Server 2005). I will run all kind of queries against this view. So, I wonder what is the best way to choose which index to be clustered. What are the criteria or is there any tools to help me around. (Sorry if my question is d...

Dynamically set the height of a graphic in SQL Server 2008 Reporting Services

HI, I have placed a graphic inside my report in SQL Server Reporting Services 2008. My only problem is that the natural behavior of the graphic is to have fixed width and heights, no matter how many items you have inside your graphic. Sometimes I have as few as 5 to 8 items in my Y axis, but sometimes I have some 20 or 25. What happens i...