sql-server-2005

Using parameterized function calls in SELECT statements. SQL Server

I have taken over some code from a previous developer and have come across this SQL statement that calls several SQL functions. As you can see, the function calls in the select statement pass a parameter to the function. How does the SQL statement know what value to replace the variable with? For the below sample, how does the query en...

SSIS: Passing parameter in OLE DB Source Editor to a table-valued function

How can I pass parameters in an OLE DB Source to call a table-valued function like: select * from [dbo].[udf_test](?, ?) When doing so, I am getting the error: Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command form v...

how to store a value returned from a sql query in a variable in batch programming ?

how to store a value returned from a sql query in a variable in batch programming ? i can invoke sqlserver queries from my cmd prompt using sqlcmd server name then the qwery this is query statement i m going to use SELECT CASE WHEN DATEDIFF(minute, record_timestamp, GETDATE()) < 10 THEN 1 ELSE 0 ...

How many maximum recursion possible for CTE in SQL server?

How many maximum recursion level possible for CTE in SQL server? If maximum recursion level is reached then what are the alternative way? ...

Distributed Transactions in SQL Server 2005

As part of a transaction I’m modifying rows in tables via a server link, so have to specify “SET XACT_ABORT ON” in my sproc otherwise it won’t execute. Now I’m noticing that SCOPE_IDENTITY() is returning NULL, which is presumably something to do with the distributed transaction scope? Does anyone know why and how to resolve? ...

Getting max. screen resolution with Group By

Question: I have a website where I gather browser statistics. Thus, I have an SQL table (T_Visits), with the following columns: uniqueidentifier Visit_UID, uniqueidentifier User_UID, datetime Visit_DateTime, float Screen_w, float Screen_h, float Resolution = Screen_w * Screen_h varchar resolutionstring = screen_w + ' x ' + screen_...

Migrating an ERP product to SQL 2008 (regular or R2) from 2000.

We are running a version behind the latest for our ERP system which runs on SQL Server 2000. My version is not supported on 2008 (regular or R2). In fact, the latest version of the ERP is not certified to work with R2 (which isn't surprising since it hasn't been released yet) I have done some preliminary testing with 2008 and it appears...

SQL dealing with rubbish in a phone number field

Hello stackers! I've got a wonderfully fun little SQL problem to solve today and thought I'd ask the community to see what solutions you come up with. We've got a really cool email to text service that we use, you just need to send an email to [email protected] and it will send a text message to the desired phone number. F...

SQL query to select records from three Tables seperatly

SQL query which select the record from three tables and there is no relation between these tables. Actually I want to make it a VIEW. suppose there are three tales Table1, Table2, Table3 I want to show records of Table1 first with some filter criteria and then the records from Table2 and in last from Table3 as when we execute the vi...

Easy plugin or procedure for sqlserver Management Studio to script row inserts.

I've never been able to find a good script or plugin for sql server Management Studio (2005 and or 2008) for a very common scripting need: specifying a few/all rows in a table and scripting their insert. You can guess my story: I've got some configuration data in my dev db and I need to script it for deployment to UAT and then product...

SQL Server, temporary tables with truncate vs table variable with delete

I have a stored procedure inside which I create a temporary table that typically contains between 1 and 10 rows. This table is truncated and filled many times during the stored procedure. It is truncated as this is faster than delete. Do I get any performance increase by replacing this temporary table with a table variable when I suffer...

Where clause on joined table used for user defined key/value pairs

Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems. For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc… You...

Help with a query

Hi Based on the following table ID Effort Name ------------------------- 1 1 A 2 1 A 3 8 A 4 10 B 5 4 B 6 1 B 7 10 C 8 3 C 9 30 C I want to check if the total effort against a name is...

Can I call a UDF at Frontend

I have a UDF in sql server. I want to call this function at frontend (C# Code). Is it possible to do it. ...

If I update a view, will my original tables get updated

suppose I have tables Employee, Locations. and I have a view viewEmpLocation which is made by joining Employee and Locations. Now If I update the view, will data in original table get updated. ...

Executing a DTS package from Sql Server 2005

I am trying to run several DTS packages from a sql 2000 box. The DTS calls will originate from .net 2.0 - 3.5 code. I have been unable to find a good way to programmatically accomplish this. What I have read is running a sql job from a stored procedure that calls the DTS package. Does anyone has any experience with this or know of a good...

Facing problem in configuring Reporting Server

Dear All, I am unable to configure reporting server with sql server 2005 express edition. I have posted the link of a screen shot which shows the status.when ever i go to configure the reporting services it gives me the following errors(see screen shot)...also unable to start the reporting services.It starts and then stopped automatical...

Connect rails application to SQL Server 2005 from Windows

Hi guys. I (sadly) have to deploy a rails application on Windows XP which has to connect to Microsoft SQL Server 2005. Surfing in the web there are a lot of hits for connect from Linux to SQL Server, but cannot find out how to do it from Windows. Basically I followed these steps: Install dbi gem Install activerecord-sql-server-adapt...

SELECT with a Replace()

I have a table of names and addresses, which includes a postcode column. I want to strip the spaces from the postcodes and select any that match a particular pattern. I'm trying this (simplified a bit) in T-SQL on SQL Server 2005: SELECT Replace(Postcode, ' ', '') AS P FROM Contacts WHERE P LIKE 'NW101%' But I get the following error;...

SQL Server 2005 Full-Text Search - can I search for forward-slash characters?

I'm trying to use SQL Server 2005's Full-Text Search to find single forward-slash characters within my indexed column, without success. Can anyone tell me if this is possible at all? Example: In my CentralSearchCache table, the SearchData column contains a row with the text "This/string/contains/forward/slashes". This query: SELECT ...