sql-server-2005

Best way to get PK Guid of inserted row

Hi all, I've read this question about getting the identity of an inserted row. My question is sort of related. Is there a way to get the guid for an inserted row? The table I am working with has a guid as the primary key (defaulted to newid), and I would like to retrieve that guid after inserting the row. Is there anything like @@IDE...

Dump of SQL Server insert data

Is there a free tool that will allow you to dump the data (not the structure) of an MS-SQL Express (2005) table as INSERT statements to a flat file? This commercial product seems to do what I have in mind. I've tried using SqlDump but my full server name will not fit in its SQL Server Name field. ...

Interpreting SQL Server syntax errors

If there's one thing that I hate about SQL Server, it's the horribly unhelpful error messages. My favorite is "Incorrect syntax near..." because it provides almost no hint as to what's wrong. Are there any tools to get a better idea of what's wrong with the statement? Or does anybody have any other helpful hints for figuring these kin...

Advantages and disadvantages between sql 2005 and sql 2008?

Exact duplicate: Advantages of MS SQL Server 2008 over MS SQL Server 2005? i am a sql developer and i use sql 2005. i want to now to pass to 2008 but i am a little affraid. can anyone gives me some advices about this. should i still continue using sql 2005 or is better pass all my projects to 2008 due to better performace? ...

How to schedule SSIS package to run as something other than SQL Agent Service Account

In SQLServer 2005, is it possible to schedule an SSIS package to run something other than the AQL Agent Service Account? I've got an SSIS package that makes a connection to a db and runs a stored procedure. My criteria is that I will not specify user names/passwords in a package or package configuration, so I want to use integrated au...

How to find what caused errors reported in a SQL Server profiler trace?

I was running a trace on a Sql Server 2005 using the profiler and need to find out what is causing the reported errors. I used the "blank" template, and selected all columns of the following events: Exception Exchange Spill Event Execution Warnings Hash Warnings Missing Column Statistics Missing Join Predicate I noticed a number of ...

Store time of the day in SQL

How would you store a time or time range in SQL? It won't be a datetime because it will just be let's say 4:30PM (not, January 3rd, 4:30pm). Those would be weekly, or daily meetings. The type of queries that I need are of course be for display, but also later will include complex queries such as avoiding conflicts in schedule. I'd rather...

SQL Server Index Which should be clustered?

I have a number of indexes on some tables, they are all similar and I want to know if the Clustered Index is on the correct column. Here are the stats from the two most active indexes: Nonclustered I3_Identity (bigint) rows: 193,781 pages: 3821 MB: 29.85 user seeks: 463,355 user_scans: 784 user_lookups: 0 updates: 256,516 Clustered Pr...

SQL Server 2005 Connection Problems With Mirrored Database

The setup is as follows: A C++ client connects via OLEDB/SQL Native Client to a SQL Server 2005 database located on another machine. The server is setup with mirroring (automatic failover) with a synchronized server located on yet another server and a witness server on another server. Occassionally (once every couple of days), our ...

SQL Server EXCEPT

Here's the situation I'm in. I have a table containing peoples' information. Some of them are imported from another system while some are imported manually. What I would like to do is pull everyone in, but if there is a record entered manually and a record that was imported, I want to select only the imported one (since it is likely m...

How do I convert a datetime field to a formatted string in SQL Server 2005?

I want to SELECT a formatted date string from a datetime type in SQL Server 2005. In the format "yyyy/mm/dd hh:mm:ss". What is the best way to do using only a query? ...

Sql Server 2005 Installation without Tools ?

I am installing SQL Server 2005 Standard Edition. But when the installation has finished installing, tools like Management Studio, Business Intelligence and Analysis Services are displayed. ...

SQL Server 2005

I have an existing e-commerce application,that allows the admin to upload image of products. As of now,the feature allows only single image upload for a product available in multiple colors.The colors are uploaded as simple csv format by admin. Business requirement has changed and the business wants that on change in dropdown for color o...

When is it appropriate to use NOLOCK?

I am having timeout issues and deadlocks from time to time with some long running queries. I'm wondering when is it most appropriate to use NOLOCK and where? Do I use it on the updates & inserts? or reads? ...

SQL Server 2005 Point In Polygon

Hello, I have a polygon structure in an sql2005 db as described below. CREATE TABLE [dbo].[Polygons]( [PolygonID] [int] IDENTITY(1,1) NOT NULL, [PolygonName] [varchar](255) NOT NULL, [PolygonColor] [varchar](7) NOT NULL, [PolygonRuleID] [int] NOT NULL) CREATE TABLE [dbo].[Polylines]( [LineID] [int] IDENTITY(1,1) NO...

SQL Server 2005, Shrinking replication database

Right now i currently using transactional replication with updatable subscription. Is there any ways (including T-SQL) that can use to shrink down distribution database used within replication schema? The file was named distribution.MDF Also i found quite large data stored on folder repldata, is it save to delete this files? And how? O...

How do i convert hh:mm:ss to hh:mm in sql server?

How do i convert hh:mm:ss to hh:mm in sql server? select Count(Page) as VisitingCount,Page,CONVERT(VARCHAR(8),Date, 108) from scr_SecuristLog where Date between '2009-05-04 00:00:00' and '2009-05-06 14:58' and [user] in(select USERNAME from scr_CustomerAuthorities ) group by Page,Date order by [VisitingCount] asc...

How to find slowest queries

Using Sql Server 2005 Profiler, what events, columns, and filters do you trace to find your slowest queries and stored procedures? Slow = greater than N seconds, 10 for sake of argument. ...

How can I group by my columns in SQL?

How can I group by Time? I tried this, but it gives the error "Invalid column name 'Time'.": select Count(Page) as VisitingCount, CONVERT(VARCHAR(5), Date, 108) as [Time] from scr_SecuristLog where Date between '2009-05-04 00:00:00' and '2009-05-06 14:58' and [user] in (select USERNAME from scr_CustomerAuthorities) group by [Tim...

error in setup sql server 2005

hello . what is meaning this error , when I want to install sql server 2005 ? > TITLE: Microsoft SQL Server Setup None of the selected features can be installed or upgraded. Setup cannot proceed since no effective change is being made to the machine. To continue, click Back and then select features to install. To exit SQL Server Setup,...