sql-server-2005

Select where has pattern in text column. sql server 2005

Hi I'm sure this is possible but am not sure how to go about it. In this case I want to find records that have text similar to this pattern '123-1234' SELECT FROM TABLE WHERE COLUMN = 'HAS pattern 3 numbers+ - + 4numbers' I think the numbers are post codes perhaps. Still bit of an sql noob. Any helpers appreciated. ...

Does ASP.net Report Viewer / Reports require Reporting Services on SQL server

I have an application that makes use of Report Viewer and Report (.rdlc) files. Does this mean that I need to have "Reporting Services" installed on my SQL server?? Also would not having "SQL Server Analysis services" affect me any way I want to make sure I keep using - SQL Server Profiler - SQL Server Agent - create and run manageme...

Copy substring of one column and copy to another.

This is a bit above my level. But am trying to learn. I don't want to seem like I'm just trying to get my homework done but would appreciate any help pointers. I am trying to find a substring (postcode) in an address column and once found, copy to the post code column I have the following sql which finds columns that match a postcode pa...

loweredrolename in aspnet_users table (SQL Server 2005)

For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too. Anyone knows what is the use of column LoweredRoleName in aspnet_users table? ...

SQL Server 2005 where condition with string comparison

I am using SQL Server 2005 with the following query SELECT * FROM EMPLOYEE WHERE EMP_NAME = 'ABCD' It gave me the proper results and when i tried the same query with 'ABCD ', then also it gave me the same result!!! I feel it should not give any results as there is no employee with name 'ABCD ' Or "WHERE" condition works like thi...

Between .. and clause in sql server?

hi, in my web application i am displaying videos of user, I want to display the videos which are between 30 days only. Videos that are uploaded last 30 days only. i write query like this but it is not working fine.. select * from videos where posteddate between getdate()-30 and getdate() order by posteddate desc can u he...

SQL server error

Hi, I am having a few problems with getting a ms sql database to work remotely. Could someone please explain to me what the following error message means. P.s I am only getting to know about the whole accepting answers thing so will be doing that from now on. Thanks 'Failed to generate a user instance of SQL Server due to failure in ret...

SQL Server 2005 HTTP Endpoint Authentication

Is there any way of setting up an endpoint that does not require Integrated Authentication or HTTPS - either basic username / password authenticaion or none at all??? ...

Incorrect SQL Syntax - Unclosed quotation mark after the character string

Now i have string a = "Unclosed quotation mark after the character string '%Bamboo.Widgets.RequestApproval.CollectTask ORDER BY Date DESC'. Incorrect syntax near '%Bamboo.Widgets.RequestApproval.CollectTask ORDER BY Date DESC'." for filter I'm using replace ("'","''") replace ("%","[%]") replace ("[","[[]") a...

T-SQL Foreach Loop

Scenario I have a stored procedure written in T-Sql using SQL Server 2005. "SEL_ValuesByAssetName" It accepts a unique string "AssetName". It returns a table of values. Question Instead of calling the stored procedure multiple times and having to make a database call everytime I do this, I want to create another stored procedure th...

Sweepstakes data model?

I want to be able to host multiple sweepstakes at a time on my website (.NET). How would YOU go about storing that data? I need to collect the user's information Assign them to the specific sweepstakes The sweepstakes have begin and end dates and may have prerequisites for entry Just wondering if you all have ever done anything like t...

SQL 2005 Management Studio throwing syntax errors while trying to save changes to a table in Design view

Just recently, SQL 2005 Management Studio started throwing syntax errors while trying to save changes to tables. These are tables being made in Design view, not as TSQL scripts. 'Build_Group' table - Unable to create index 'PK_Build_Group'. Incorrect syntax near ','. Based on the error, it seems that the recreation of the clustered in...

Is there a way to bind a variable type to column data type?

In Oracle PL/SQL, you can always bind your code variables' type to a specific table.column type like this: myVar TABLE.COLUMN%TYPE So, if you change the column's type, you don't have to go over your code to re-define related var types (of course you'd still need to check you are properly using the variable). Is there a similar way to...

Sql Query Pervious Row Optimisation

Here is my table structure MyTable ----------- ObjectID int (Identity), -- Primary Key FileName varchar(10), CreatedDate datetime ........... ........... ........... I need to get the time taken to create record in a file... ie... Time elapsed between the previous record in the same file and the current record of the same f...

Why does this stored procedure not return the correct ID?

Intermittently this stored procedure will return an ID that is in the millions when it should actually only be around 400. set ANSI_NULLS OFF set QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[TestStoredProcedure] ( @Title VARCHAR(50), @ID INT OUTPUT ) AS DECLARE @ResultsTable Table(InsertedID INT); INSERT INTO Table ( T...

SQL - Only select records from weekends

I need to write a SQL Select statement to select all the records where DateCreated falls on a weekend for the last 4 weeks. I know I can do this by hard-coding the select like the one below. But I was wondering if there was an easier way using T-sql date functions. SELECT * FROM audit_table WHERE DateCreated BETWEEN '07-31-2010 00:00...

Which DAL approach to take?

ActiveRecord is too limiting normally. However, i'm in a difficult situation in terms of the views held by each member of the team in regards to using ORM's. We currently use a very basic ActiveRecord with regret I say is written mostly by hand with some basic generation of code. I would like to build a new DAL for us but avoiding the li...

SSIS 2005: "Append rows to the destination table" is greyed out. Why?

In SQL Server 2005, Import Data (SSIS), my desire is to import a text file and have it append to an existing table. The first time through the wizard on the Column Mappings step I swear the Append rows to the destination table radio button was enabled. But, now, it's disabled (grey) and even re-starting the wizard won't cause it to re...

SQL Statement Question - How to retrieve records of a table where the primary key does not exist in another table as a foreign key.

I have a table (TableA) where the primary key exists as a foreign key on another table (TableB). I am trying to write a SQL query (I am using SQL Server 2005) that will find all of the records in TableA where the primary key does not exist in TableB as a foreign key (we'll say joining on TableAID). I suspect it will use an outer join, ...

New to SQL how do I get both contactsid's from contacts and tasks using a left outter join?

I wrote this report to display how long it takes a user to finish their first task. currently it will only display contacts that have tasks. I need it to display both contacts with and without tasks any ideas? SELECT c.MarketSource AS [Market Source], ...