sql-server

Connecting to an SQL Server mdf file via PHP

I currently have a school assignment that involves both PHP and asp.net. Now the assignment is that I make an E-commerce website with PHP and it's CMS with asp.net. Therefore both websites connect to the same database which is in SQL Server. At the moment using Visual Studio's SQL Server Express, and I have generated an mdf file as the ...

To find the dependency of object accross multiple databases?

How can you find the dependencies of a table accross databases? Normally sp_depends will provide information for all dependent objects on a particular objects, or through a GUI tool you can see it in a more structured way. Now dependencies shown by these methods are limited to a single database - what if we have dependents in other data...

"public" role access in SQL Server

Hi, Can anybody let me know that what permission does public have in sql server. Thanks ...

How do I save a stream to a file?

I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a .gif or .jpg or .pdf). Existing Code: StreamReader sr = new StreamReader(myOtherObject.InputStream); I need to save this to disk (I have the filename). In the future I may want to store this to SQL Server. I h...

Identity insert

Hi, can anybody please, explain that what does SET IDENTITY INSERT ON AND OFF do. Thanks, Chris ...

Application execute complex SQL query

My application needs to execute a fairly complicated series of queries against a database. Normally I would just dump everything into a stored procedure and execute it that way. But I do not have access to the database I'm trying to access so I can't create a stored procedure. Is there a better way of doing this instead of hitting t...

ANSI NULLS

Hi, Can anybody let me know that what does SET ANSI NULLS ON do . Thanks, Chris ...

Is it possible to perform multiple updates with a single UPDATE SQL statement?

Let's say I have a table tbl with columns id and title. I need to change all values of title column: from 'a-1' to 'a1', from 'a.1' to 'a1', from 'b-1' to 'b1', from 'b.1' to 'b1'. Right now, I'm performing two UPDATE statements: UPDATE tbl SET title='a1' WHERE title IN ('a-1', 'a.1') UPDATE tbl SET title='b1' WHERE title IN ('b-1',...

SQL Delete (Suspended in activity monitor)

I have a table containing hundreds of entries and I am trying to delete a small range. It is taking a long time, in fact it is not being executed. I monitored the query from the activity monitor and its status is "Suspended" Is there anyone knows what may cause this problem? ...

How to organise a VSTS Database Edition Solution/Project (GDR)?

We use TFS and are looking at using VSTS Database Edition GDR . I would like to know the best way to structure our projects and wondered if anyone has any experience in this. Let me explain our environment. We have 3 environments, DEV , TST and PROD. Each of these have multiple databases. Currently, we have solution file(s) for eac...

How can I find odd house numbers in MS SQL?

The problem is I need to ignore the stray Letters in the numbers: e.g. 19A or B417 ...

Why is SQL Server 2005 Randomly Truncating Whitespace?

The following T/SQL:- create table #temp(foo varchar(10)) insert into #temp select '' insert into #temp select 'abc' insert into #temp select ' ' select len(foo) from #temp where foo = ' ' drop table #temp Returns two 0's, despite the fact the criteria means it should return nothing. Additionally it's returning the length of the t...

SQL Server Reference a Calculated Column

I have a select statement with calculated columns and I would like to use the value of one calculated column in another. Is this possible? Here is a contrived example to show what I am trying to do. SELECT [calcval1] = CASE Statement, [calcval2] = [calcval1] * .25 ...

Why the Full-Text indexing option is greyed out?

I installed SQL Server 2008 Express with Advanced Services, but when I try to create a new database, the option Full-Text indexing is greyed out, I believe the full-text indexing has been installed, because I did a query as below: use [mydbname] select fulltextserviceproperty('isfulltextinstalled') This query returns 1, so I think it...

Error using the Pivot transformation in MS SQL Server 2005

Hi, I have the following table which I'm pivoting: (ID, Name, Value) 1, 'Task ID', 123 1, 'Language', 'Java' 2, 'Task ID', 456 I have set the PivotKey to be the Name column, and the PivotedValue to be the Value column. For each of my new columns (Task ID and Language) I have set their PivotKeyValue to be 'Task ID' and 'Language' re...

How should I import highly formatted data from Excel to a database?

What is the best way to import highly formatted data from Excel to SQL server. Basically I have 250+ Excel files that have been exported from a reporting tool in a format that our business users would prefer. This is a 3rd party tool that can not export data in any other format. I need to "scrub" these files on a monthly basis and impor...

Filtering With Multi-Select Boxes With SQL Server

I need to filter result sets from sql server based on selections from a multi-select list box. I've been through the idea of doing an instring to determine if the row value exists in the selected filter values, but that's prone to partial matches (e.g. Car matches Carpet). I also went through splitting the string into a table and joini...

MS-SQL Express 2005/2008 multi instance CPU and memory utilization

With SQL Express (either 2005 or 2008 edition) there is a limit of 1GB memory and 1 CPU that can be used. What I'm wondering, is if two instances are installed on the same machine, would they use the same CPU and same 1GB of memory? Or, would they use potentially two different CPU's and 2GB memory? ...

Why does the SqlServer optimizer get so confused with parameters?

I know this has something to do with parameter sniffing, but I'm just perplexed at how something like the following example is even possible with a piece of technology that does so many complex things well. Many of us have run into stored procedures that intermittently run several of orders of magnitude slower than usual, and then if yo...

How can I make the Tab Drop Down In Sql Server Management Studio display more of the File Names

Am I the only person annoyed by this? I don't even know what proc I'm clicking on if the file names have the same prefix, or are longer than the context window width. ...