sql-server-2005

advantages in specifying HASH JOIN over just doing a JOIN?

What are the advantages, if any, of explicitly doing a HASH JOIN over a regular JOIN (wherein SQL Server will decide the best JOIN strategy)? Eg: select pd.* from profiledata pd inner hash join profiledatavalue val on val.profiledataid=pd.id In the simplistic sample code above, I'm specifying the JOIN strategy, whereas if I leave off ...

Dialect for SQL2005

Hi all, I am new to Hibernate. We are migrating one of our existing web application which uses Hibernate 3 and SQL 2000 server to SQL 2005 server. Can I get help about which version of Hibernate to use with SQL 2005 as I could not find any dialect for SQL 2005 in Hibernate 3.0.5? Thanks in advance. ...

SQL Server 2005 to MySQL connection

I want to be able to email a report daily from a glpi database in MySQL. I would like to create a SSIS job to pull data from MySQL. How do I do this? ...

What is the use of replication in SQLSERVER2005

Hi can any body tell me what is use of replication in sqlserver2005. backup and replicaton looks same?what is diference b/w them ...

Help needed with Dynamic Pivoting in SQL2005

I have a table of name value pairs where I am storing tags: TAGID | NAME | VALUE I have a table of 'Things' this tags apply to THINGID | TAGID I need a query to generate a resultSet were the columns/fields are all possible TAG-NAMES (NAME field in the TAG table)for a given THINGID and the values are the correspondent tag values. T...

How to break on Insert in Visual Studio / SQL Server 2005

II'd like to use Visual Studio to break whenever a record is inserted into a certain table, so I can see the values being inserted and the call stack from that moment. Is that possible, or am I stuck with stored procedure debugging only? ...

What does "%%DatabaseEx" do in TSQL?

I was looking at the source of sys.sp_dbcmptlevel in SQL Server 2005. In the source, there is this line I do not understand how it works. EXEC %%DatabaseEx(Name = @dbname).SetCompatibility(Level = @input_cmptlevel) It doesn't appear that DatabaseEx is a stored procedure. -- does not return any result select * from sys.procedures whe...

How can I have Sql Server 2005 asynchronously call a DOS batch file from a DDL trigger?

I created a batch file to run SqlMetal and generate Linq2Sql data classes, check into source control triggering a build, etc... I'd like to have this script run anytime there is a DDL change in Sql Server 2005. Running the batch file via xp_cmdshell works fine outside of a trigger, like this: exec master..xp_cmdshell 'd:\dev\db_trigge...

Select a Variable TimeSpan with an Arbitrary End point

I've been working on a Stored Procedure that checks the time, then retrieves records going back over the last full 24 hour period between 8am and the previous 8am. So, for instance, assume that it's currently 10am. The stored procedure looks at the current time, notes that it is past 8am, and sets the query to run backwards 24 hours, f...

Can't access single row in SQL Server 2005 table

I have a small (200 rows / 400kb) table with 4 columns - nvarchar(MAX), nvarchar(50), and two ints. I'm having a problem with one particular row in which I can select and update the int fields, but when I attempt to select or update the nvarchar fields, the query runs indefinitely (at least 45 minutes before I cancel). I'm also unable ...

Easy way to import/export Sql Server 2005 users/permissions across instances?

Is there an easy way to export and then import users/permissions from one Sql Server 2005 instance to another? ...

Is there any way to create a table with the same layout as a view in SQL Server 2005?

I can't really think of the best way to phrase this question, so I'll just give an example. Suppose I have a table that is created like this: CREATE VIEW People AS SELECT id, --int name, --varchar(20) birthdate --datetime FROM SomeTable If I wanted to change this from a view to a physical table, is the...

Best practices and/or advice for diamond relationing tables (Linq to SQL)

I have to import the content of 4 tables from an old database into SQL 2005 for easier reporting. Products contains the id and product name, ProductProperties contains a variable number of properties for each product, Ingredients contains a variable number of ingredients for each product, and IngredientProperties contains the same prope...

How to make a column case sensitive in sql 2005 or 2008

Is it possible to change the default collation based on a column? i want to make 1 column case sensitive but all the others not ...

SQL Server 2005 workgroup edition users?

How many concurrent users on a Sql Server 2005 workgroup edition? Too 1 database? Too entire server? ...

Safely modify a replicated column's data type in SQL Server 2005?

What command would I execute to safely change (i.e. from int to bigint) a replicated column's data type in SQL Server 2005? The column is not a key. There is a non-clustered index on the column. ...

Extreme wait-time when taking a SQL Server database offline

I'm trying to perform some offline maintenance (dev database restore from live backup) on my dev database, but the 'Take Offline' command via SQL Server Management Studio is performing extremely slowly - on the order of 30 minutes plus now. I am just about at my wits end and I can't seem to find any references online as to what might be ...

SQL Server 2005 & Antivirus Software

Our Network people insist on having antivirus (eTrust) software on ALL servers, including all of our SQL Server 2005 machines. How can I best demonstrate that this is hurting performance? ...

Finding breadcrumbs for nested sets

I'm using nested sets (aka modified preorder tree traversal) to store a list of groups, and I'm trying to find a quick way to generate breadcrumbs (as a string, not a table) for ALL of the groups at once. My data is also stored using the adjacency list model (there are triggers to keep the two in sync). So for example: ID Name Par...

How do I run a TSQL script that returns a value?

Am I correct in saying it is TSQL? I am a novice at database scripting. Is this called scripting? I am a novice at this, really I am. I just wrote a stored procedure in SQL Server Management Studio: CREATE PROCEDURE dbo.LogTable_Count @Count INT OUT AS SELECT @Count = Count(ExperimentId) FROM LogTable GO I would like to test ...