sql-server-2005

Exclude weekends and custom days (i.e. Holidays) from date calculations

Currently, I am calculating a finish date based on the start date (DateTime) and duration (# of days), but my calculations do not take into account weekends or holidays. So, my solution is not correct. This was just a starting point. I read some articles out there and one approach is to create a gigantic calendar table that has all the...

command line to create data source with sql authentication?

I'm looking to run a batch file on windows xp professional which creates a system odbc data source for a sql server connection. I can do that with: ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=Kappa| Description=Kappa Data Source | SERVER=10.100.1.10 | Trusted_Connection=Yes | Database=subscribers" However I need a way to set the sql ...

Dealing with XML datatype(SQL SERVER 2005)

Hi, I have a table having 2 columns EmployeeId (int) and EmployeeDetails(XMl type) EmployeeId EmployeeDetails 1 <Employee><EmployeeDetails><EmployeeName> Priyanka </EmployeeName><Age> 24 </Age><Address> Argentina</Address></EmployeeDetails></Employee> 2 <Employee><EmployeeDetails><EmployeeName> Sarkar </EmployeeName><Age>...

How to change column order in a table using sql query in sql server 2005?

Hi all, How to change column order in a table using sql query in sql server 2005? I want to rearrange column order in a table using sql query. Please help. ...

How to set the result of exec storedproc to a variable?

Hi all, I need to exec a storeproc and store its scalar result to a local variable inside a storedproc. How to implement? E.G. CREATE PROCEDURE [dbo].GetNthNo AS DECLARE @a INT DECLARE @d INT DECLARE @n INT DECLARE @S INT SET @S=EXEC spGetNthNo @a,@d,@n SELECT @S Please help. ...

Alternative for look up task in SSIS

i am working on a SSIS solution for datawarehouse for extracting Surrogate keys of corresponding application keys, I am using look up task of SSIS but the problem with this task is it caches the complete look up table in its memory . And my look up table size is huge i.e. 20 million records. So if u can suggest some ways or alternatives ...

SSIS 2005 Process Task Timeout Issue

Here is what I am trying to do. I have a perl script that browses a website, fills out a form, and submits the form. This process takes about 1 minute to complete and will initiate an asynchronous process on the website to create a report and drop it to an FTP site. After the form is submitted I would like to kill the process and repo...

Temp tables in SQL Server 2005 not automatically dropped

Hi there, I'm troubleshooting a nasty stored procedure and noticed that after running it, and I have closed my session, lots of temp tables are still left in tempdb. They have names like the following: #000E262B #002334C4 #004E1D4D #00583EEE #00783A7F #00832777 #00CD403A #00E24ED3 #00F75D6C If I run this code: if object_id('tempdb.....

Calculating unique bids on an product

Products (productId INT PK, bidCount INT) Bids(bidID INT PK, productId INT, userId INT, isCounted BIT, created DATETIME) There is a 1:many relationship between a product and bids. Each biding cycle lasts for 1 day, so I need to track unique bids per day and update the bidCount column. I set isCounted = 1 for every row that I process d...

Is it possible to pass a table name into a stored proc and use it without the Exec Function?

I would like to create a SP or UDF where I supply a table and column name as a parameter and it does something to that target. I'm using Sql Server 2005 Trivial Example of what I'm trying to accomplish: CREATE FUNCTION Example (@TableName AS VARCHAR(100)) RETURNS TABLE AS BEGIN SELECT * INTO #temp FROM @TableName RET...

Temporary Tables and SQL Server Replication

I'm a bit of a noob, so pardon me if the answer to this question seems obvious. I have been tasked with the creation of SSIS packages that will operate in an environment maintained by another company. They're using replication to publish updates from client sites to a centralized server, and I'm not entirely certain how they've got it se...

Pass table as parameter into sql server UDF

I'd like to pass a table as a parameter into a scaler UDF. I'd also prefer to restrict the parameter to tables with only one column. (optional) Is this possible? EDIT I don't want to pass a table name, I'd like to pass the table of data (as a reference I presume) EDIT I would want my Scaler UDF to basically take a table of values ...

SQL Server restore from transaction log

In SQL Server 2005, if you have a database with no backup - but it is running in full recovery mode - is it possible to "roll back" some deletes? If yes - how? ...

SNIReadSync executing between 120-500 ms for a simple query. What do I look for?

Hi Stackoverflow, I am executing a simple query against SQL Server 2005: protected static void InitConnection(IDbCommand cmd) { cmd.CommandText = "set transaction isolation level read uncommitted "; cmd.ExecuteNonQuery(); } Whenever I profile with dotTrace 3.1, it claims that SNIReadSync method is taki...

What is the best way to group and aggregate and sum tree data?

Given a self referencing table Item ------------- Id (pk) ParentId (fk) With a related table of associated values ItemValue ------------- ItemId (fk) Amount And some sample data Item ItemValues Id ParentId ItemId Amount -------------------- ---------------------- 1 null ...

best method to update the SQL table data from c# .NET 2005

Hi , I have a dataset with some 30 records in it. I want to update it to the database tables. which is the best method to update the table. I am unable to use dataadapter.update() since i am using a procedure to populate the dataset. is there any efficient way to update other than iterating through EACH record ...

is it Efficient to use Mars to Update 7000 Rows?

I have a service to update/inserts 7000+ rows using MARS. Is there a better way to do this? ...

sql server property "maximum server memory" disabled

I want to set the maximum server memory option for a SQL server, but this option is disabled for me. i have logged in through windows authentication, and logged into windows with the administrator user. you can find this option by right click on DB server -> Select Properties -> Memory tab. Please see the screenshot of the properties s...

Intriguing SQL Server performance-tuning problem

Hi there, I have been working on a stored procedure performance problem for over a week now and is related to my other post on Stackoverflow here. Let me give you some background information. We have a nightly process which runs and is started by a stored procedure which calls many many many other stored procedures. Lots of the called ...

Problem in the connection string of Microsof SQL Server 2005 !

Hi, I have MSSQLServer 2005 installed on my machine. I am creating a connection string like this: String sqlConnectionString= user id=admin; password=admin; server=MachineName\MSSQLSERVER; Trusted_Connection=no; database=MYDataBase; connection timeout=30 When I do: myConnection = new SqlConnection(sqlConnectionString); myConnection.O...