sql-server

Sql Server Disk Estimating Tools?

I'm looking for a 'calculator' of sorts for planning and estimating Sql Server disk space. Can anyone recommend something. I thougth about building an Access database tool for such but thought that this may have been done already. ...

SQL Buckets Determine Age Grouping

I have a database with legacy data that stores transactions and uses a "bucket" method for determining account balances. I need a way to get aged past due for accounts. Table Transactions TransactionId TransactionType (CHARGE,RECEIPT) Amount PostDate To get the current balance: SELECT SUM(CASE TransactionTypeId WHEN RECEIPT THEN Amoun...

Question about Time Statistics, Execution Plan and "print"

In trying to determine what area of a large query i have is causing performance problems i took three steps. Including the execution plan, setting time statistics to on and printing immediately before and after sections that i believe might cause a problem. Example: print '1' SELECT ID FROM Test print '2' When i look at my execution...

How to save file in SQL Server database if have file path??

I am building some C# desktop application and I need to save file into database. I have come up with some file chooser which give me correct path of the file. Now I have question how to save that file into database by using its path. ...

How to return SQL Server 2005/2008 columns as identical child nodes using FOR XML query?

Basically I need to return some data from a SQL Server table in the following XML format: <querydata> <entity name="Person.Contact"> <row> <field name="FirstName">Gustavo</field> <field name="LastName">Achong</field> </row> <row> <field name="FirstName">Catherine</field> <field name="LastName">Abel<...

please help me to create a sql query

i have following 3 tables CREATE TABLE [dbo].[dspartner]( [dspartnerid] [bigint] IDENTITY(1,1) NOT NULL, [name] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [priority] [int] NULL) CREATE TABLE [dbo].[hotels]( [hotelid] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL, [name] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS...

SP_Who does not return DBName Column

My Delphi application connects to a SQL Server Database through BDE. In the process, my application queries SP_Who stored procedure to get the DbName column Value. But now I want to connect my application through ODBC to the SQL Server database. I'm using the SQL Server Native client driver for this, but when my application queries SP_...

Sql server takes too long time for update query to execute for few rows

Hi Guys, UPDATE table1 SET col1='True' This query takes more than 30 secs for about 6000 records. Why is it so slow? ...

how to deploy the CLR functions in SQL server 2008

I created a SQL Server Project in VS2008 called 'RegularExpression'.In that Project i created a 'Regex.cs' class and i wrote one function regarding Regular Expression. Then i Build the solution. Now My problem is to deploy this solution in SQL server 2008 through scripts.( not just clicking on Deploy in VS2008 ). I succeeded up to dep...

Is there any difference between sql server that comes with VS2008 and sql server express 2008 ?

hi Is there any difference between sql server that comes with visual studio 2008 and sql server express 2008 ? thank's in advance ...

Check In between two times

I want to check in IF in sql server.. I am having check in time and parm1time and paramtime2 I want to return the value if checkin time is between param1 and param2 how can I write. Example @checkin = 10.00 param1 = 2.00 param2 = 13.00 How can I do this in sql query IF COndition ...

Synchronizing two Sql Server 2008 databases in same instance

Hi All I want to synchronize two databases (DB1 and DB2) present in same instance. Lets say if i create a table or make any changes to a existing table (e.g. altering the structure) in one database DB1, those should be reflected on the other database DB2 Please help Savitha ...

Sqlconnection does not support parallel transactions

I want to run two transactions simultaneously. So i gave MultipleActiveResultSet = false in the connection string as specified in an MSDN article. But after modifying the connection string i get "Target machine actively refused". I'm working with WCF. Any ideas in this? Thank you. ...

Reporting Services - Get the results for a specific period through a longer period

Original Question with Query attached as requested, thank you Hello, I have a table that retrieves data over a 3 day period on an hourly basis, there are several different machines that work on a specific bottle for a period of time, during the three day period there could be several different bottles go on that machine. I want to show...

What GUID can I use as a placeholder

I have a database table that has a non null column of type uniqueidentifier. This was put in place for use in the near future. But for now, I need to use some placeholder. Can I simply use: 00000000-0000-0000-0000-000000000000 for all the rows until a real guid is used when new rows are inserted in the future? Does SQL Server enforce ...

Once I have a database project in Visual Studio, if I edit a stored procedure or view, how do I apply the changes to the server?

Once I have a database project in Visual Studio, if I edit a stored procedure or view, how do I apply the changes to the server? ...

SQL Server Int or BigInt database table Ids

I am writing a new program and it will require a database (SQL Server 2008). Everything I am running now for the system is 64-bit, which brings me to this question. For all of the Id columns in various tables, should I make them all INT or BIGINT? I doubt the system will ever surpass the INT range but it is a possibility within some of t...

SQL Server stored procedure question

I have a SQL Server stored procedure which has been in use for years. This stored procedure calls lots of other procedures. I would like to extract each inside procedure one at a time and implement its business logic to a .NET Class project. In order to do that, I have to call .NET assembly from parent stored procedure and the returned...

Sql Server: Count records (including zero) per ten-minute intervals

I currently have a table (SQL Server 2005) that logs the visits against my web app, and I want to put together some code to report (and display a visualization) of that traffic. What I want is to display the number of visits during each ten-minute interval over the last 24 hours. I have a query that does just that, but there are ten-min...

Bulk DELETE on SQL Server 2008 (Is there anything like Bulk Copy (bcp) for delete data?)

Is there any solution for bulk delete in SQL Server? I can't use TRUNCATE because I want to use WHERE for limiting the rows in action. Is there anything like Bulk Copy (bcp) for delete data? ...