sql-server

how to ping a url from sql server 2008 stored proc

Hey guys, I want to ping a url over http from a sql server 2008 stored procedure. What is the best and easiest way to do this? UPDATE: To make it more clear, I just want to call an aspx page from a stored procedure to notify my aspx page that data has been modified and aspx needs to refresh the cache. I know that I can do this via sql...

Any hidden pitfalls changing a column from varchar(8000) to varchar(max)?

I have a lot (over a thousand places) of legacy t-sql code that only makes INSERTs into a varchar(8000) column in a utility table. Our needs have changed and now that column needs to be able to handle larger values. As a result I need to make that column varchar(max). This is just a plain data column where there are no searches prefor...

Finding similar names in multiple tables

I have multiple tables with different customer names. I am trying to find out how many times the same name is in a table. The challenge here is that someone could have entered the name as "John Smith" or "Smith, John". There are 40,000 rows in each table and over 40 different tables. I am trying to query somehow without knowing the name...

Backup SQL Server Database with progress

Does anybody know how to backup SQL Server 2005/2008 database with C# and get the database backup progress? ...

SQL ERROR: Verify that the instance name is correct and that SQL Server is configured to allow remote connections?

I am getting following error while connecting to my local Sql Express: An error has occurred. Details of the exception: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is ...

Stored procedure - return identity as output parameter or scalar

When you insert a record into a table with an identity column, you can use SCOPE_IDENTITY() to get that value. Within the context of a stored procedure, which would be the recommended way to return the identity value: As an output parameter SET @RETURN_VALUE = SCOPE_IDENTITY() As a scalar SELECT SCOPE_IDENTITY() Another way? Any pro...

SQL Server 2005 bigint missing?

I am trying to set a column as a 64-bit integer, but my only available options are tinyint, smallint and int. Where did bigint run off to? Notes: I'm using Access 2008 to access my SQL Server. ...

Full text search Sql Server 2008 question

Hi, Let's say I have the following string stored in a column which has full-text: xx 3 555 7 4 My question is why a search using FREETEXT for the word '555' would not return anything ...

Converting adjacency list tables to MPTT in SQL Server 2008

Is there a helpful tool or script resource to aid conversion from old-school adjacency list tables to MPTT? I would have thought it was a problem faced by a few cleverer souls than I in the past, and thought I'd check here first in case they came up with a clever solution in their travels - before embarking on my own journey to do such ...

Writing a dreaded SQL search query (2nd phase)

I am working on a search query (with an asp.net 3.5 front end) which seems quite simple, but is quite complex. The complete query is: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[usp_Item_Search] @Item_Num varchar(30) = NULL ,@Search_Type int = NULL ,@Vendor_Num varchar(10) = NULL ,@Search_User_I...

sql server function native parameter bind error

I'm using the following software stack on Ubuntu 10.04 Lucid LTS to connect to a database: python 2.6.5 (ubuntu package) pyodbc git trunk commit eb545758079a743b2e809e2e219c8848bc6256b2 unixodbc 2.2.11 (ubuntu package) freetds 0.82 (ubuntu package) Windows with Microsoft SQL Server 2000 (8.0) I get this error when trying to do nativ...

SQL Script Help, combine two queries into one

I was wondering if these two queries could be combined into a single query? Query 1: to get the @guidID to be plugged into Query 2: DECLARE @guidID uniqueIdentifier SET @guidID = (SELECT guidID FROM dbo.table1 WHERE IntID = 1) Query 2: retrieves a combined table from a function and table1 SELECT o.guidID, IntID, Title, func.Nam...

How do you update a DateTime field in T-SQL?

The following query does not update the datetime field: update table SET EndDate = '2009-05-25' WHERE Id = 1 I also tried it with no dashes, but that does not work either. ...

How to connect an existing SQL Server login to an existing SQL Server database user of same name

Is there a SQL Server command to connect a user of a single database to a login for the database server of the same name? here's the example: Database Server - Default Instance Database: TestDB Server Login - TestUser Existing user on TestDB - TestUser If I try to make the TestUser login a user of the TestDB database, the "User, grou...

In what format is SQL Server data serialized when it is sent through the network?

The reason I am asking this question is because we are planning to read A LOT (several GB's) of data from a SQL Server database to a .Net app for processing. I would like to know how much space overhead to calculate for each record for estimating the impact on our network traffic. E.g. a record consists of 5 integers (which makes 4 * 5...

Is there any good way of editing 'text' values in SQL Server Management Studio?

I am needing to edit several text fields in a SQL Server database. What would be the best way of doing this? The only solution I have so far is writing an update statement(along with escaping quotes and such) to update it.. This just seems really cumbersome though. Is there a better way? ...

Creating Greek Data

I heard a term "Greek Text" for dummy unintelligible text for testing in QA. Is it a correct term? If yes, how do we create this data? Thanks ...

NHibernate YesNo on SQL-Server CE No mapping exists from DbType AnsiStringFixedLength

Trying to use nhibernate on sql-server compact edition for unit testing and having some trouble. At the moment I just have one entity which is: <class name="Audit" table="eolaudit_llk"> <id name="ID" column="eolauditlk_ky"> <generator class="identity"></generator> </id> <property name="Name" column="eolauditlk_nm" /> <property name=...

select from access database file and insert to sql Database

Hi All, I have an access database file (test.mdb) and I need to write a stored procedure which will select some records from tblTest in test.mdb and insert them into tbsqlTest in my sql database . ==> I need a SP like this : BEGIN select * into tblTest from [test.mdb].[tblTest] where (my condition) END ...

How can I get SqlBulkCopy to tell me which column had the truncation error

I am using SqlBulkCopy to import from an external DB. When importing into an nvarchar column, if the column isn't big enough to hold the incoming string, it fails with: InvalidOperationException: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. String or binary data...