sql-server-2008

Replication in workgroup

I have configured transactional replication with Publisher and distributor which are on same and subscriber on different servers. Publisher and Distributor are running on MSSQL 2008 and the subscriber is running on MSSQL 2008. The both PC are running in the same workgroup. When I go to view synchronization status on Publisher, i am gett...

SQL Server 2008 - db mail issue

Hello. I have two instances of SQL Server 2008. One was upgraded from SQL Server 2000 and one was a clean, new install. SQL Mail operates perfectly on both instances. DB Mail operates perfectly on the newly installed instance. On the upgraded instance, DB Mail does not send any mail. Of course, I am not positive that the fact this...

Not able to run SSIS package from Stored Procedure

I created an ssis package. It runs fine when i run it from command prompt. But when i run it from query analyser using xp_cmdshell, it gives the error below Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this informat...

Is SQL Server DRI (ON DELETE CASCADE) slow?

I've been analyzing a recurring "bug report" (perf issue) in one of our systems related to a particularly slow delete operation. Long story short: It seems that the CASCADE DELETE keys were largely responsible, and I'd like to know (a) if this makes sense, and (b) why it's the case. We have a schema of, let's say, widgets, those being ...

Using MS SQL Server Analysis Services to create cubes on hierarchical data

I have a hierarchy, like an ProductDimension hierarchy. Currently, I query this table using the Nested Sets methodology. I write the usual star-schema joins to get a time-series report of groups of Products (Batches, CountryOfOrigin, ProductLine, etc.). I'm currently investigating using SSAS cubes- but can a cube model this? Are ther...

OpenDataSource fails pls help

I'm trying export records from SQL Server 2008 to mdb file using OpenDataSource. It works when I log in using Windows authentication. But it fails when I use SQL Server authentication. This is the error i get OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not delete from specified ...

32bit to 64bit sql server 2008 database conversion

We are in the process of moving databases from older 32 bit hardware running sql 2005 to newer hardware with sql 2008 64 bit. My question is if the database is automatically converted to 64bit after it is reattached on the new server or if it is running in 32bit mode on a 64bit instance. Is there a way to tell? ...

How to implement paging in NHibernate with a left join query

I have an NHibernate query that looks like this: var query = Session.CreateQuery(@" select o from Order o left join o.Products p where (o.CompanyId = :companyId) AND (p.Status = :processing) order by o.UpdatedOn desc") ...

how to use a parameterized function for the Default Binding of a Sql Server column

I have a table that catalogs selected files from multiple sources. I want to record whether a file is a duplicate of a previously cataloged file at the time the new file is cataloged. I have a column in my table (“primary_duplicate”) to record each entry as ‘P’ (primary) or ‘D’ (duplicate). I would like to provide a Default Binding for...

SQL Server 2008 database timeout after delete

I'm running the following statement, it is working locally with SQL Server 2008, however, there is SQL Server 2008 Express on the development server, and after the sql statement runs, I am unable to do SELECT statements on the table in which I deleted the record. Both databases were created with the same table creation scripts. "DELE...

sql server 2008 export to mdb issue

Hi i'm trying to import records from a mdb file to sql server 2008. i have a separate db server and application server. wrote a stored proc to import data from mdb. But it fails as the mdb is on a network. It works if it's on the db server itself. i'm using sql server account. if i login using windows account and try the same sp it w...

Force INSERT only via stored procedure

Using SQL Server 2008, is there a way to allow inserts to a table only via a stored procedure, and if so how? EDIT: The best way to go is probably Martin Smith's suggestion to use an INSTEAD OF INSERT trigger. The direct answer to this question is marc_s' one with GRANT and DENY, though it won't limit some user accounts. ...

2 large databases - worth merging into 1?

I have 2 large databases that were sharded before. I now have removed the sharding and have created a new database with all of the data except for the tables that were originally sharded. Is it worth importing this data into the new database, or keeping them as seperate entities that I can just scan through? We are talking around 60mi...

Are there any Linear Regression Function in SQL Server?

Are there any Linear Regression Function in SQL Server 2005/2008, similar to the the Linear Regression functions in Oracle ? ...

Not your usual "The multi-part identifier could not be bound" error

I have the following query, now the strange thing is if I run this query on my development and pre-prod server it runs fine. If I run it on production it fails. I have figured out that if I run just the Select statement its happy but as soon as I try insert into the table variable it complains. DECLARE @RESULTS TABLE ( [Paren...

Determine what user called my stored procedure

I'm sure this has been asked, but search isn't returning the answer. In a stored procedure, how do I get the value of the user/login that called the stored procedure (name?), assuming I don't already have server_user_id ...

Recursive Query Help

I have two tables in my database schema that represent an entity having a many-to-many relationship with itself. Role --------------------- +RoleID +Name RoleHasChildRole --------------------- +ParentRoleID +ChildRoleID Essentially, I need to to be able to write a query such that: Given a set of roles, return the unique set o...

Problem with Access 2003 linking tables with SQL Server 2008 using ODBC

I am trying to link an Access 2003 DB to tables in a SQL Server 2008 database using ODBC. When I try to link to tables that have Primary Key established I get the following error message. " 'Pk_dbo.Batch_Claims' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not to long. " Pk_d...

Sql Server xml column with Entity Framework - how to keep insignificant whitespaces

Sql server 2005 (even 2008) strips the insignificant whitespaces by default. To keep one can use the CONVERT funtction with the last argument as '1' (Ref. Article). How can we do the same thing in Entity Framework? thanks ...

Changing default settings in SQL Server Enterprise

In Microsoft SQL 2008 Enterprise manager, when you right click a table to open it the option only grabs the first 1000 rows. Same thing with an edit except it limits the result to 200 rows. Is there a way to increase this in the context menu? I know I change the SQL once it loads, but I'd like to set the default value myself so I don't h...