sql-server

Sql Server Maintenance Plan Tasks & Completion

Hi All, I have a maintenance plan that looks like this... Client 1 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client Client 2 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client Client N ... Import Data and Process Data are calling jobs and Post Process...

script Table as Create via SSMS doesn't show unique index

Using SQL Server Management Studio 2008, why can't I see unique index ( not primary key ) when I generate Create Table SQL code? It includes only primary key constraint. Is it by design ? There is a possibility to get SQL code for index creation via right mouse click on an index and "Script index as", but it is another step. ...

sql query calculating no of employees joined each financial year i.e from 1-04-2002 to 31-03-2003

I have a table in which joining dates are give in datetime format. I have to calculate how many employees joined each financial year resp. ie for eg from 1-04-2002 to 31-03-2003.this should work for each year..from 2003 to 2004,2004 to 2005...n so on. can anybdy help? thanxx. ...

Need recommendation for a table structure

I have an entity which has 4 different types of property that could have only one value for each case which are boolean, decimal, string or text. I don't want to define the table with 4 boolean, decimal, nvarchar and ntext columns. What would you recommend to cover this case? Update: I'm using MS SQL Server. Here is the class definit...

User is not able to log in after some time

I am using asp.net mvc along with SQL server. An user of my application created a username like "abcd efgh", with space between the user name. it worked for some time and now it stopped working. I checked that user is entering the correct data. This happened even user did not have a space in it. I set up the membership database using Asp...

Define a varbinary(max) column using sqlalchemy on MS SQL Server

Hi, I'm querying an SQL Server database using SQLAlchemy and need to cast a column to varbinary(max). The thing I am struggling with is the "max" part. I can get the cast to work for any actual number (say varbinary(20)), but I cannot find how to get it to work for the "max" size of the varbinary column. Any pointers? Links? Solutions?...

ORM vs SQL XML, very simple middle-tier

I know it is rather heated question. But anyway I'd like to hear opinions of those in Stackoverflow. Given that XML support is quite good in SQL Server 2005/2008, and there's no concern about database independency, why one need Linq-to-SQL, Entity Framework, NHibernate and the likes, which are quite complex and awkward in advanced use-ca...

Is there any function in SQL Server to convert a number into Time format?

I am getting a whole number for the duration of product. For example : 62, 103, 184, 4543. I want to convert it in time format. Let say , in case of 62, it would format like '00:01:02'. I am looking for a function which can resolve my problem. Is there any function in SQL Server which convert a number into time format? ...

How can i add '"-" in column

my query is showing in row 2000 the data of 2000-2001 & in 2001 the data of 2001-2002. how can i change the column so that it displayes column 1 column 2 2000-2001 5 2001-2002 3 2002-2003 9 2003-2004 12 . . . . and so on... ...

In SQL Server, how do I create a reference variable to a table?

I'm currently using sp_executesql to execute a T-SQL statement with a dynamic table name. However, it is really ugly to see something like: set @sql = 'UPDATE '+Table_Name+' SET ... WHERE '+someVar+' = ... AND '+someVar2' = ...' sp_executesql @sql What I would rather like to have is a TABLE variable of which is a reference to a table...

SSRS 2008 User Generated Report Subscriptions with Windows Integrated security - possible?

I'm having a problem with my SSRS 2008 configuration at the moment. This is how we are currently set up. 1 server hosting SQL Server and SSRS, no integration with sharepoint etc. Users access the SSRS web application, and then from there they access the "Report Builder 1.0" too, which they can use to create and run reports based off a...

Query containing Logic

empno emailID -------------------- 1 [email protected] 2 [email protected] 3 [email protected] 2 [email protected] 1 [email protected] 1 [email protected] 3 [email protected] Write a query so that result will be :-- empno emailID -------------------- 1 [email protected],[email protected],[email protected] 2 [email protected]...

How to get exact OmanTime ?

how to get the exact OmanTime using an sql function? This is my code : RETURN DATEADD(mi,-90,@CurrentDate) but it is not correct. ...

Free web based query builder

is there any opensource component available like EasyQuery.net ? where we can assign datasource to component and later on we can create custom sql criteria. ...

How to put XML returned by stored procedure in a variable?

Hello I have stored procedure returning XML. XML returned not as parameter but as result of SELECT: create procedure #xml_test as select 1 as a for xml raw go I'm trying to put this XML in a variable: declare @xml as nvarchar(max) But I can't find how to do it. My best idea was INSERT INTO ... EXEC, but I get error 'The FOR XML ...

Stored procedure optimization

Hi, i have a stored procedure which takes lot of time to execure .Can any one suggest a better approch so that the same result set is achived. ALTER PROCEDURE [dbo].[spFavoriteRecipesGET] @USERID INT, @PAGENUMBER INT, @PAGESIZE INT, @SORTDIRECTION VARCHAR(4), @SORTORDER VARCHAR(4),@FILTERBY INT AS BEGIN DECLARE @ROW_STAR...

How to access SQL Server scalar funtions in MS Access VB

Hello, I'm trying to find out how I can access scalar functions from the SQL Server database of my adp file. I have an adp file in access 2007 and a SQL Server 2005 DB. In access VB I try to get the result of a scalar function with parameters. I tried with DAO, but it that case currentdb = nothing: Dim dbs As DAO.Database Dim sq...

SSIS Runs Okay Individual Tasks, Not Together

I have a simple SSIS Project. In the control flow I have three steps: Step 1: Select Data from Db1.Table1 Step 2: Create Table2 in Db2 Step 3: Copy Data in Db1.Table1 to Db2.Table2 If I "Execute Task" one by one in order, it executes fine...but if I try running the entire project I receive the following error: Error a...

What are the disadvantages of VistaDB

I am looking into using a lightweight serverless database engine like SQLite, Firebird, or VistaDB in an upcoming project. Someone asked about What are the advantages of VistaDB. I would like to know what are the disadvantages of using VistaDB versus other technology? UPDATE: VistaDB out of business (the real disadvantage) I have jus...

Very Different Execution Times of SQL Query in C# and SQL Server Management Studio

I have a simple SQL query that when run from C# takes over 30 seconds then times-out every time, whereas when run on SQL Server Management Studio successfully completes instantly. In the latter case, a query execution plan reveals nothing troubling, and the execution time is spread nicely through a few simple operations. I've run 'EXEC ...