sql-server-2005

SQL Server reporting services-- table group not setting page break

Hi everyone, I’m using SSRS 2005 and had a question about table grouping and page breaks. There’s a table in my report that’s not inserting page breaks and I’m hard pressed to see why. I’ve assigned a DataSet to this table, and am displaying a group header in it-- the grouping is based on a record ID value. I don’t have any footers, ...

SQL Server 2005 - are stored procedures named sp_MSdel_ related to replication?

I have a server here in my home office setup to receive push subscriptions from a server at our company HQ. I was looking through the list of stored procedures today and see many of them with 'sp_MSdel_' prepended. Are these related to replication? Can they/should they be deleted or left alone? I don't see any of these types of store...

What criteria does SQL Server use to order its records, when none is specified on retrieval

Will the order of the record retrieved using a select query, be in the same order if retrieved infinite number of times, each time using a new connection? (to the same table, same select) What order method is used when none is specified?   ...

sql server view, will it update its self, or does it require me to create a new one?

A view created, certain users have direct access to the database using the same web application. If the base table is changed (data) will the view automatically reflect the changes/insert in data, or will it need to be created again and again? Vs08 sql-server-2005 c#   ...

How can I get Stored Procedure return value in C# ?

I have a stored Procedure that do some operation and return 1 or 0 as below CREATE PROCEDURE dbo.UserCheckUsername11 ( @Username nvarchar(50) ) AS BEGIN SET NOCOUNT ON; IF Exists(SELECT UserID FROM User WHERE username =@Username) return 1 ELSE return 0 END and in C# i want to get this returned value i try ExcuteScalar b...

I am trying to get comfortable creating joins with T-sql 2008

I am trying to write this select statement. My select statement consists of a join that returns all of the first and last names of my fictional employees, their department names and I am trying to group the individuals by their respective departments. This is the code I wrote: select e.First_Name,e.Last_Name,Department_Name from EMPL...

The correct syntax for a T-SQL subquery and a possible join

What would be the correct syntax and join (if any) of a subquery that would return all of the employees first and last name from the employee’s table, and return their department name from the department table, but only those employees who more than the average salary for their department? Thanks for your answers ...

function to generate names for non registerd users

How to create or what is the logic of function which Generate names for non registered users using given name as string variable using sql 2005 (like registering in hotmail ,yahoo) ...

Date difference in SQL Server 2005.

Hi, Let's say I have two dates in my table, DueDate and PaidDate. What I need to do is calculate the difference between those two dates. However, if the DateDiff() returns less than 0, it should show 0. DateDiff(Day, 0, (PaidDate-DueDate-1)) as DelayDays Should show 0 for anything less than 1. Thank you. ...

I am trying to correct this error code in T-SQL that states that I have an invalid column

This was my original question: “What would be the correct syntax and join (if any) of a subquery that would return all of the employees first and last name from the employee’s table, and return their department name from the department table, but only those employees who more than the average salary for their department? Thanks for your...

SQL query for displaying product sales.

I have sales table which consists, ItemSize, GroupName, Quantity, ProductID, etc... Now I want to display sales according to following format GroupName ItemSize Quantity ItemSize Quantity means BEER 350ml 500 650ml 1000 How I can achieve this in SQL SERVER 2005 EXPRESS (T-SQL)? Thanks UPDATED: its my sales table...

Problem in string permutation

Will it be a right choise to do string permutation in C# or SQL SERVER ...

Problem in displaying hierarchical records (SQL Server 2005) [SET BASED]

I can make query to get the Master -Chile records. But how to display them in hierarchial fashion. Any example will help I am using SQL Server 2005 ...

Replication related issue,

Replication related issue, I am explaining my architecture . I have created , its transactinal replication process 2 Publisher on table vendors script I have given below, A Distributor 2 Subscribers Data replication set up is like this as : Table VENDORS gets replicated from 2-publishers to 2-subcribers via-Distributor. Whil...

Help creating an INSERT INTO statement

I am inserting rows into SQL Server 2005 from PowerShell. I need to add a WHERE NOT EXISTS clause to my code to stop inserting duplicates. I am testing the SQL code in SSMS and cannot get it to work. Where is the mistake in the following code? INSERT INTO dbo.PrptyValSrce (PrptySrceName, PrptyNameSrce, PrptyValSrce, PrptyTS) VAL...

Multiple Count() from a single table.

Is there a way to get multiple counts depending on multiple conditions from the same table? eg. Count for when Days is less than 15, and count for days between 15 and 30. ...

displaying data from multiple tables

i have 3 table (SalesLog, Breakages, SalesReturn), I want to display data from these table like ProductName SalesQty BreakQty ReturnQty ABCD 1000 10 20 SalesLog Table CREATE TABLE [dbo].[SalesLog]( [SalesID] [int] IDENTITY(1,1) NOT NULL, [MemoNo] [int] NULL, [Product...

Adding inner query is not changing the execution plan.

Consider the following queries. select * from contact where firstname like '%some%' select * from (select * from contact) as t1 where firstname like '%some%' The execution plans for both queries are same and executes at same time. But, I was expecting the second query will have a different plan and execute more slowly as it has...

Inserting string variable into S-Proc parameter

I'm receiving an error for the following query: EXEC dbo.sp_Sproc_Name @Param1=@ParamValue1 ,@Param2='lorem ipsum "' + @ParamValue2 + '" dolor' I get the error: Incorrect syntax near '+'. Therefore, how can I pass a variable as part of my parameter value like I'm trying to do above? Many Thanks. ...

Does varchar(max) = varchar?

I noticed that I can write SELECT CAST(Min(mynumber) AS VARCHAR(Max))+'mystring' AS X as SELECT CAST(Min(mynumber) AS VARCHAR)+'mystring' X Will I regret leaving out the (Max) parameter? ...