sql-server

VS 2010 Database Project - SQL03006 Error

I created a new SQL Server Database Project within VS 2010, imported the database objects and settings from a local database named "managers", and received the following error while attempting to build the project: SQL03006: View: [dbo].[vw_mlFunds] has an unresolved reference to object [managers].[dbo].[mlfunds]. I don't know why ...

ASP.net SQL server universal date problem.

I need to solve the following problem for one of my clients. They have an installer which installs a SQL server database + IIS website. The SQL database user can have any kind of date format (DD/MM/YYYY, MM/DD/YYYY,...) depending on the locale of the sql server. The IIS website can have any kind of date format (can be different from sql...

MSSQLSYSTEMRESOURCE DATABASE

what is mssqlsystemresource database? do we need to copy this while moving form one server to another one? ...

SQL Server 2000: Length of field in 1/3 (or 2/3) of the records

Is there a simpler/cleaner way to do this using SQL Server 2000? Every few days I need to do this. I first look at how many records we have total: SELECT COUNT(*) FROM MyTable Then I list all the lengths of a certain field: SELECT LEN(MyText) FROM MyTable ORDER BY LEN(MyText) ASC I then need to scroll down 1/3rd of the way... and...

sql server:what do brackets mean around column name?

i added a field in sql server 2008 and it put the column name in brackets like this [column2], but the other column names dont have brackets. what do the brackets mean? the column is [macro-writer] should i remove the minus sign and replace with underscore? ...

SQL Servers: Linked-servers without linking servers?

Both my local (and remote) SQL SERVER 2005 administrators claim that "allowing linked-servers is a security issue" and forbid their use here. (Huh?) Anyway, is there a way to do something similar WITHOUT linked-servers? SELECT * FROM LOCAL_SERVER.MyDatabase.dbo.MyTable AS t1 INNER JOIN REMOTE_SERVER.MyDatabase.dbo.MyTable AS t2 ON t1....

Regular Expression in Visual Studio Find & Replace - multiple spaces between search terms

I require a regular expression for the Visual Studio Search and Replace funtionality, as follows: Search for the following term: sectorkey in ( There could be multiple spaces between each of the above 3 search terms, or even multiple line breaks/carriage returns. The search term is looking for SQL statements that have hard-coded Secto...

Silverlight 4: Running a stored procedure which returns a string

I have a problem executing a stored procedure in Silverlight 4/RIA. The only value I get back is null. Am I doing my client and server side code wrong? Client Side : public ZipCodesDomainContext _ZipcodesDomainContext = new ZipCodesDomainContext(); /// <summary> /// Creates a new <see cref="MainPage"/> instance. ...

SQL Server stored procedure vs an external dll

I am trying to convince someone that using an external DLL to manage sql data is better then using stored procedures. Currently the person I am working with is using vba and calls sql stored procedures to get the complicated data they need from many different sources. It is my understanding that the best way to go about this kind of acti...

How to find range of a number where the ranges come dyamically from another table?

If I had two tables: PersonID | Count ----------------- 1 | 45 2 | 5 3 | 120 4 | 87 5 | 60 6 | 200 7 | 31 SizeName | LowerLimit ----------------- Small | 0 Medium | 50 Large | 100 I'm trying to figure out how to do a query to get a result similar to: PersonID | SizeName ------...

What are prepared statements? How are they different from dynamic sql?

I did not see any duplicate questions but wondering if somebody can provide some good examples and specially best practices around these. ...

Is it possible to figure out if a specific field has been updated, in a Sql Server Trigger?

Hi folks, if i have a simple table and I want to do something (say .. execute a stored proc) when a field (and i know the field i wish to look at) has changed. Is this possible? Version: Sql Server 2008 R2. Example table :- ID INTEGER PRIMARY KEY Name NVARCHAR(100) NOT NULL Age TINYINT NOT NULL HairColour TINYINT NOT NULL So .. if...

select in sql server 2005

I have a table follow: ID first end a 1 3 b 3 8 c 8 10 I want to select follow: ID first end a-c 1 10 But i can't do it. Please! help me. Thanks! ...

Remove duplicates - SQL server 2000-2005

Only for MSSQL 2000-2005 by SQL query and no stored procedures No cursors and temp tables The table create table my_table ( row_id int identity(1,1), _key varchar(20), _total decimal(18,2) ) Insert the data insert into my_table (_key,_total) Values('qwe',10) insert into my_table(_key,_total) Values ('qwe',10) insert into my_table(...

SQL Server - Delete unused rows

I need to get stored procedure (not standart, only custom) to delete unused rows table (table1) and some other tables (table2, table3, table4...- we don't know how many tables refers to table1 by FOREIGN KEY CONSTRAINT) can refers to this table. For example: СREATE PROCEDURE [dbo].[delete_on_constraints] @table varchar(36) – table name...

Sql server 2000 pivot query

Hi everyone. Please forgive me if this has been answered before. I'm looking for some advice on how to build a pivot or cross tab query. I have a table that looks likes this Vessel Date Inspector A 02/05/10 Morris B 05/20/10 Clouseau A 07/25/10 Gadget I need the results to be look like this Vessel J...

Analysis Services for SQL Server 2008 R2 Express

Is it really to add Analysys Services for existing instance of SQL Server 2008 R2 Express? ...

Tracking Microsoft SQL Server Activity

I have a very strange and complicated situation. I have data being erased from one of my SQL Server tables, and I am not sure by what application. I would like to be able to track this. As I am sure you are wondering how I could find myself in this situation, here is some background. We have 2 servers, Web and Database running IIS6 and...

SQL to retrieve tree structure nicely

Given the simple data structure: ID | Category_Name | Parent_ID Example: 1 Cars 0 2 Boxes 0 3 Lamborghinis 1 4 VW Camper Vans 1 5 Big Boxes 2 6 Small Boxes 2 7 Cereal Boxes ...

sql server 2008 security

1-when adding new user to database there is schemas owned by this user whet exactly does it do and if you add permission to it you cant remove it later and is it connected to default schema 2- please explain take ownership permission thank you ...