sql-server

Filestream in Sql Server 2008 Express

i tried to get it to work but i never seem to have to luck, i go a code snippet for a blog and still no dice. This is the code. EXEC sp_configure filestream_access_level, 1 GO RECONFIGURE GO CREATE DATABASE NorthPole ON PRIMARY ( NAME = NorthPoleDB, FILENAME = 'C:\Temp\NP\NorthPoleDB.mdf' ), FILEGROUP NorthPoleFS CONTAINS FILESTREA...

How do I return an empty result set from a procedure using T-SQL?

I'm interested in returning an empty result set from SQL Server stored procedures in certain events. The intended behaviour is that a L2SQL DataContext.SPName().SingleOrDefault() will result in CLR null value. I'm presently using the following solution, but I'm unsure whether it would be considered bad practice, a performance hazard (I...

Entity Framework Performance Inconsistency Compared to Sql Management Studio

I'm getting timeouts with a very basic EF statement. I'm simply doing a select from a single table with a Entity.Title.StartsWith("test") and a .Take(25). When I run this for a search that returns no results I get a timeout. If I profile and grab the sql statement it looks fine, and if I run that sql in Management Studio it runs in a ...

How to get rank from full-text search query with Linq to SQL?

I am using Linq to SQL to call a stored procedure which runs a full-text search and returns the rank plus a few specific columns from the table Article. The rank column is the rank returned from the SQL function FREETEXTTABLE(). I've added this sproc to the O/R designer with return type Article. This is working to get the columns I ne...

removing duplicates from table without using temporary table

hi! I've a table(TableA) with contents like this: Col1 ----- A B B B C C D i want to remove just the duplicate values without using temporary table in Microsoft SQL Server. can anyone help me? the final table should look like this: Col1 ----- A B C D thanks :) ...

Cannot connect to sql server

Hi I cannot connect to Sql server remotely from management studio , It is corrrect User name and password, but how to enable remote connections to a sql server? what is other chances? Cannot connect to xxxx.xxxx.xxxx.xxxx =================================== A network-related or instance-specific error occurred while establishing a c...

sql server swap data between rows problem

I was asking b4 about swaping query to swap data between rows in same table and i got that qurey ALTER PROCEDURE [dbo].[VehicleReservationsSwap] -- Add the parameters for the stored procedure here (@FirstVehicleID int, @secondVehicleID int, @WhereClause nvarchar(2000)) AS BEGIN Create Table #Te...

can I get count() and rows from one sql query in sql server?

I'd like to get the total count of results and top n rows of some query - is it possible in one statement? I'd expect the results as: count(..) column1 column2 125 some_value some_value 125 some_value some_value Thank you in advance! ...

What does ON [PRIMARY] mean?

I'm creating an SQL setup script and I'm using someone else's script as an example. Here's an example of the script: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[be_Categories]( [CategoryID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_be_Categories_CategoryID] DEFAULT (newid()), [CategoryName...

Joining null in SQL Server, Oracle and informatica

Hi! I have two tables to join with a column (say emp_id).. if emp_id in both the tables have null values, how will SQL Server and Oracle treat??? Coz, I read that informatica will neglect the NULL rows when joining..if I handle the null, by substituting -1, a cross-join will happen which i don't want.. What can I do here? I cannot co...

Conditional WHERE Clauses in SQL Server 2008

Hello, I am trying to execute a query on a table in my SQL Server 2008 database. I have a stored procedure that uses five int parameters. Currently, my parameters are defined as follows: @memberType int, @color int, @preference int, @groupNumber int, @departmentNumber int This procedure will be passed -1 or higher for each parameter....

What is wrong with this simple update query?

Besides being unsafe... I get no error message, but the row is not updated. The rows integer is set 1 following the query, indicating that 1 row was affected. String query = "UPDATE contacts SET contact_name = '" + ContactName.Text.Trim() + "', " + "contact_phone = '" + Phone.Text.Trim() + "', " + "contact_fax ...

looking for word parts with full text search in sql server

how do I find, with full text search all words that match 'ability' mask, like "suitability" and "dependability", etc? is that possible? ...

SQL Server merge statement source and target issue

Hello everyone, I am using SQL Server 2008 Enterprise and using the new Merge statement. From my experiment, I find source is always read only (table content not modified, i.e. no record is deleted/inserted/updated)? Is that correct understanding? thanks in advance, George ...

Understand Sql Server connectionstring for asp.net

Hi, I am trying to understand the differences between the following 2 connectionstrings. one uses servername\instancename and the other one uses the server ip address. Can I specify port number for "serverName\instanceName". I know you can specify port number for ip address, something like '10.0.0.1,xxx'. thanks, Server=myServerName...

How to find out whether sql server login has any user mapped to using SMO.

I need to write a function to delete the login in the database if it does not have any users to map to using SQL Server Management Objects (SMO). How can I achieve this ? Just like to add that when using the login.EnumDatabaseMappings(),when there are no users mappped to the login , will return null.So you can not use something like log...

Json and images

hi, I've got a db on a server and want to get some data fro my iphone. I use TouchJson and everything works fine but I've got a little problem. I don't know how to download images. When I try to build and run the app the emulator just crashes. Got any ideas what to do? ...

Help ---- SQL Script

Store No Store Name Region Division Q10(response) Q21(response) 2345       ABC              North Test              1                       5 2345                            North Test              6                       3 2345       ABC              North Te...

SQL SELECT with time range

Hi, I have below click_log table logging hits for some urls site ip ua direction hit_time ----------------------------------------------------- 1 127.0.0.1 1 20010/01/01 00:00:00 2 127.0.0.1 1 20010/01/01 00:01:00 3 127.0.0.1 0 20010/01/01 00:10:00 .... ......... ...

Windows workflow foundation published as a web service and Sql Service persistance

Hi i try to add persistance to my workflow using sql service persistance and all i know is how to add Persistence Service to the Workflow Runtime using code in the host app or web.config file.i my case i have WF as a webservice so i add to my Web.config this code: <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersist...