sql-server

Need help with SQL aggregation query

What is the most straightforward approach to producing a data set that can be used in a SQL Server Reporting Services report to display the following: SalesPerson # Sales # Gross Profit John Doe 100 $140,000 $25,000 Everyone Else (Avg.) 1200 $2,000,000 $250,000 Jane Smith ...

Most Executed Stored Procedure?

We created so many inefficient stored procedure in our application, we always postpone to make it more efficient until we have serious problem with database performance. Now, I am thinking to fix it one by one order by most often executed stored procedure. What is the best way to figure out which stored procedure is the most executed? ...

performance difference between User Defined Function and Stored Procedures

If a statement return rows doing a simple select over the data base, is there performance difference between implement it using Function and Procedures? I know it is preferable to do it using function, but it is really faster? ...

Package tsql with application

How can I release a winform application to a user that takes advantage of a local sql database. I would assume that I need to install the database during some kind of setup phase, but is this kind of thing possible? Is there a free version of tsql that can be used in this way? Mysql? ...

Is there any way to set lock_timeout on a database or connection string level?

In SQL 2005/2008 is there any way to set default lock_timeout values. Anything at the server, database, or connection string level would be great. ...

SQL Server PRINT SELECT (Print a select query result)?

I am trying to print a selected value, is this possible? Example: PRINT SELECT SUM(Amount) FROM Expense ...

Getting current system time in SQL Server

how do i get current system time stamp in SQL Server. ...

DotNetNuke Manual

Hi There, Is there any free DotNetNuke manual? and also C# version of the program? Thank in advance ...

looking for a simple but complete sample for SSIS or a tutorial

Hi I'm looking for a complete sample or tutorial (requirements, conditions, how to work...)to start working with SSIS. Indeed, I've installed SQL server 2008 developer edition recently. Thanks for any help ...

Sql select query with where from multiple columns

I have a simple table CREATE TABLE a( id int IDENTITY(1,1) NOT NULL, x varchar(50) ) I found that following query works select cast (id as varchar(3))+cast (x as varchar(3)) c from a where cast (id as varchar(3))+cast (x as varchar(3))='1a' but this does not work select cast (id as varchar(3))+cast (x as varchar(3)) c...

SQL Server backup issue

Hello everyone, I am using SQL Server 2008 Enterprise on Windows Server 2008 x64. I want to run daily job at mid-night every day to make full backup of database. Any reference document to follow for a newbie of this topic? thanks in advance, George ...

How to avoid circular relationship in SQL-Server?

I am creating a self-related table: Table Item columns: ItemId int - PK; Amount money - not null; Price money - a computed column using a UDF that retrieves value according to the items ancestors' Amount. ParentItemId int - nullable, reference to another ItemId in this table. I need to avoid a loop, meaning, a sibling cannot become a...

Insert base 64 string into SQL Server database

Dear guys I get a base 64 string from a XML file which I want to insert into my SQL Server database. Which field type have the field in my database to be? varbinary(MAX)? Do I have to convert the base 64 string to another format before inserting into my database? Best regards ...

Compile single string from sql results

Possible Duplicate: TSQL query to concatenate and remove common prefix Hi How does one compile a single string from the results of an SQL query. E.g. Table A Column: Name Row 0 : John Row 1 : Sam Row 2 : Kate Resulting SQL query must return a single row with the result as a single string. E.g. "John, Sam, Kate" Note: U...

Telling if a transaction has uncommitted updates

In our application, there's a database update that is committed only after a consequent update is being executed (both using the same transaction, of course). However, we've discovered a rare flow in which the user exits the application before the second update, causing the first to be discarded. I'm looking for a way to recognize this u...

Copy one table into another fails - "Column names in each table must be unique"

When I try this: SELECT * -- INTO DB2.dbo.CustomerOrderLines FROM DB1.dbo.CustomerOrderLines INNER JOIN DB1.dbo.CustomerOrders ON DB1.dbo.CustomerOrders.Order_Display_Ref = DB1.dbo.CustomerOrderLines.Order_Display_Ref WHERE DB1.dbo.CustomerOrders.Delivered_Date BETWEEN '2009-09-23' and '2009-09-24' it show the rows correctly. When ...

Sql Server Management Studio Object Explorer dissapeared - missing - vanished

ok, my Sql Server Management Studio Object Explorer had dissapeared. I know the shortcut F8, and the view->object explorer method.. neither do anything, ive clicked everything on the keyboard, googled around, but nothing.. really need this back, its a massive hassle having to navigate through the summary window without the object explor...

Convert Database Rows into Columns

I need to convert Database rows into columns and show the result in Gridview. My DB is as follows: ID Hotel cDate Price ----------------------------------------------- 1 Hotel1 12/22/2009 12:00:00 AM 15.0000 2 Hotel2 12/22/2009 12:00:00 AM 25.0000 3 Hotel3 12/22/2009 12:00:00 AM 60.0000 4 Hotel4 12/22...

Any benefits to SQL Management Studio 2008 when only connecting to SQL Server 2005 databases?

We run SQL Server 2005 exclusively for databases that we use (I'm trying to push to get them upgraded, but alas!). On the client side with Management Studio, are there any benefits to upgrading to SSMS2008 when only connecting to SQL Server 2005 databases? I've seen that Intellisense won't work, so I'm curious if it's worth the hassle. ...

maximum number of filegroups in a database?

maximum number of filegroups in a database? ...