sql-server-2008

Using sets as inparameters to function/sproc in SQL Server 2008?

Hello! Is it possible to use a set, like (1, 2, 3, 4, 5) for example, as inparameter to a Sproc, function or view in SQL Server 2008? What should I use of Sproc, function or View for this pice of SLQ? WITH Scores AS( SELECT ItemId, SUM(Score) AS Score FROM [Presenta].[presenta].[LpivScores] WHERE // HERE ...

Speed up SQL Management Studio's Object Explorer on a shared hosting SQL Server environment

Hello! When I expand the "databases"-folder in the Object Explorer in SQL Management Studio Express it tends to load ALL databases that exists on my shared host. This results in very long delays (the app freezes totally and sometimes also crashes). I just need to see the object tree of one database. Is there any way to overcome this i...

SQL Server 2008 FILESTREAM performance

I had some questions around the FILESTREAM capability of SQL Server 2008. What would the difference in performance be of returning a file streamed from SQL Server 2008 using the FILESTREAM capability vs. directly accessing the file from a shared directory? If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 seco...

SQL Server FILESTREAM storage

If I have a SQL Server 2008 database that uses FILESTREAM and stores 10 terabytes of files. Must all the files reside on the same physical box (requiring a 10+ terabyte server)? Or can I store 1 terabyte on one server, another terabyte on a second server, and so on? From what I have read it appears you can only store files on a single...

LINQ and SQL Server performance tuning the SQL Server 2008 database best practice?

My question is what is best practice to optimize performance using LINQ for SQL And performance is response time out in the user interface. Right now I have some sales data in a SQL Server 2008 database and I display this data (MAT, yearly, in different segments, growth in segment, percent of market growth ,,,,) in charts in a ASP.NET a...

Varchar with trailing spaces as a Primary Key in SQL Server 2008

Is it possible to have a varchar column as a primary key with values like 'a ' and 'a', is gives always this error "Violation of PRIMARY KEY constraint" in MS SQL Server 2008. In Oracle dons't give any error. BTW I'm not implementing this way I'm only trying to migrate the data from oracle to sql server. Regards ...

Is there any way I can execute this SPROC and get the result with Entity Framework?

This SPROC "returns" a table with two columns: Id, Score. Is it possible to execute this SPROC and include the custom data-type as parameters from within Entity Framework? ALTER PROCEDURE [presenta].[SearchLpi] // The presenta.IdTableType is a table with just one column "Id" @selectedLpis presenta.IdTableType READONLY AS BEGIN...

FILESTREAM access via streaming API

On a web server, we plan to pull back a file stored in SQL in a FILESTREAM using the Win32 streaming API. Are there any special ports that must be opened to make this work? Or will the standard 1433 suffice? ...

SQL to identify missing week

I have a database table with the following structure - Week_End Sales 2009-11-01 43223.43 2009-11-08 4324.23 2009-11-15 64343.23 ... Week_End is a datetime column, and the date increments by 7 days with each new entry. What I want is a SQL statement that will identify if there is a week missing in the sequence. So, i...

T-SQL - Called called the current proc

Is there way to tell what proc called the currently executing stored procedure. ...

SQL Snapshot Isolation limits

For my database application, employing snapshot isolation for certain of its queries' transactions seems perfect for solving one of the critical requirements. I'm worried, though, how choosing snapshot isolation (which I believe must be enabled database-wide) now will bite us once we start getting very high volumes. What is the cost of...

Expanding active file tab names in SQL Management Studio?

Is there anyway I can expand the names of any query tabs I have open in SQL Server Management Studio? It's almost impossible to navigate them properly if I have more than five open. See below for an example: http://img697.yfrog.com/i/41684451.jpg/ ...

SQL Execute Insert or Update based if the Data is already in the Table

is it possible to execute a query that inserts the Row if the ID don't exist and Update the Row if the ID already exists in a single sql statment? i mean not using stored procudures just plain SQL. i already doing LoadRecord and if noone returned then insert and if any record is returned then update. but i wanted to know if there is any ...

Create local Linked Server using Server Name or IP Address?

Based on the answer I received on this question (http://stackoverflow.com/questions/1911969/...) I have set up a Linked Server on SQL Server 2008 to a Pervasive database. Since both databases are on the same physical server, what would be the recommended method to create the linked server, using the IP Address of the server or the Serve...

What is the difference between bulk copy (bcp) and bulk insert in SQL Server 2008?

What is the difference between bulk copy (bcp) and bulk insert? Is there a switch to export all of the data in all of tables in a database for bcp? ...

Access Denied in SQL 2008 EXPRESS

Well now at the end of my program I'm facing an access denied Dim sqlFile As SqlFileStream = New SqlFileStream(filePathName, fileToken, FileAccess.Write) This is the last command in order to write the STREAM image in the table. This command returns me an 'Access Denied' error no other comment. I have give in my account a Login rela...

sql Merge databases.

Hi I have a Databse "Product" in in sql 2008.I have another Databse "ORDER" in sql 2008. Both exist in different servers. Now the requirement is to Merge both databases, and test pointing the applications to this new DB. Can anyone suggest the best way to accomplish this without losing the information? I have 2 options. 1) Script th...

Structurally and visually organising DBs and tables in SSMS

Hi Within the next few weeks I plan to introduce SQL server to an office that is in dire need of a proper data server. Currently there is a heavy reliance on loose Excel and Access file (supplemented with frighteningly large amount of impenetrable VB code to do data manipulations) strewn all over the internal network. We need SQL serve...

Searching whether data in one table exists in another table using full text search SQL Server 2008

Hi, I am trying to find out whether I can do the following using joins instead of looping through each record. Table1 ------------ LastName FirstName Table2 ------------- UniqueId LastName (full text indexed) FirstName (full text indexed) for each record in table1, I am trying to find out if there are any matching records in table...

How to alter SQL in "Edit Top 200 Rows" in SSMS 2008

In SQL Server 2008 Management Studio, when I right click on a database table and choose "Select Top 100 Rows", I can then e.g. easily add a "ORDER BY " statement to the SQL. That works fine. But when I do choose "Edit Top 200 Rows", I don't have the ability to alter the SQL (which makes it hard to find and edit a record just added in th...