sql-server

Backup database to disk in SQL Server unknown location of writable folder

Hi, I use command "Backup Database " to disk to copy databases programmatically. However this command requires to specify exactly where to put the backup. I don't know in advance on which machine the script will be run so I don't know where specific MSSQL server has permission to write. Perfect place would, of course, be MSSQL data fold...

Connection string problem with New ASP.Net Website template

Hi, This is the connection string that gets generated with the "New ASP.Net Website" template in vs 2010 <connectionStrings> <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"...

A tool to create full SQL-Sever database backup on a shared hosting?

I have a website on a shared hosting. I want to do a full backup of a Sql-Server 2005 database. I can connect to db using server management studio but I cannot do full backup because I cannot reach any filesystem (due to hosting limitations). Can anybody help? ...

Trimming text strings in SQL Server 2008

Hello, I have a table in a SQL Server 2008 database. This table has a nvarchar(256) column called 'Name'. Unfortunately, the values in this field have extra spaces included. For instance the name 'Bill' is actually stored as 'Bill ' in the table. I want to update all of the records in this table to remove the ext...

SQL Server Indexed view for Full Text Search

I want to use the Full Text Search feature of Microsoft SQL Server. If I have a table Client which refers other tables like City, Country, Department, etc. is it better to create a separate table that would hold de-normalized data, which would then be full text indexed, or is it better to create a dummy value in every foreign table (for...

Plain text connection to SQL Server 2005

If I did not want to create SqlConnection and SqlCommand objects etc etc but instead wanted to use only System.Net.WebClient (or some other "essentially plain text" communication) to talk to a SQL Server 2005 or above database, how would I go about connecting, issuing commands and receiving result sets? I'm assuming I'll need to do a lo...

what is the best free tool to import data from SQL Server to SQL Server CE 3.5 SP2?

well i went to that page http://erikej.blogspot.com/2009/04/sql-compact-3rd-party-tools.html there is a lot of tools there but its not clear which one will do the job right so any help? ...

How to automate script generation using SMO in SQL Server?

I would like to automate script generation (in SSMS --> Tasks --> Generate Scripts) in SSMS 2008. I have read that SQL Server 2008 does not support Database Publishing Wizard (including SQLPUBWIZ SCRIPT) but this automation can be done using SMO in SQL Server 2008. I don't have a clue about SMO and how to do this using SMO, so could you ...

Error when inserting data in non-unique index

I have a batch job that synchronizes data between two identical databases using the MERGE statement. Sometimes, I get the following error: cannot insert duplicate key row in object 'dbo.MatchPlayerStatistics' with unique index 'IX_MatchPlayerStatistics_Player'. That does not make sense because IX_MatchPlayerStatistics_Player is not a uni...

SQL Server 2008 tables name problem

hi, Could you tell me how to remove the database name from the table's name. Each time I create a table the database name is automatically prefixed to the name this is my table definition Create table Links ( Id Int IDEntity(1,1) , DisplayName Varchar(250) NOT NULL, Href Varchar(250) NOT NULL, Tooltip Varchar(550) NOT NULL, IsVisible...

SQL Server 2005 Express: In Database Properties Transaction log filegroup currently says 'Not Applicable'

Hi The database files (mdf ldf) were taken from a crashed machine and loaded using the attach method. Since everything has been working fine, except when i try to truncate the transaction log the file size does not change and i now notice that it says Not Applicable against the filegroup entry for the transaction log in database propert...

NULL comparison

Hello all, There is a query: UPDATE MyTable SET nvarchar1 = 'blahblah' WHERE Id = '096fe792-7313-416f-b3c8-327f46be73b6' AND nvarchar1 <> 'blablah' It doesn't work, when nvarchar1 is NULL. How should I change it to make it work? It is important to me don't execute update, if value has not been really changed. I don't know column t...

Why does my DB project's .dbmdl file change even when I make no changes to the project?

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even...

Create SQL Server Alias Using WMI on x64

I have a small app which automatically creates necessary SQL Server Alias entries for some servers. The bulk of the code looks like this: private static void SetAlias(string aliasName, string server, string protocol, int? port) { var scope = new ManagementScope(@"\\.\root\Microsoft\SqlServer\ComputerManagemen...

Force addition/deletion of a linked server and correct syntax to import data into a table from Excel

Hi all, I'm trying to create a linked server in Sql server 2008 R2, just tried downloading the '64-bit version of the Office 2010 Access AD Engine' exe from Microsoft. Unfortunately, I had tried adding a linked server, BEFORE making this installation, and it failed: EXEC sp_addlinkedserver 'LinkedServer1', 'Excel', 'Microsoft.Jet.OLE...

Why do table variables work when I execute this query in SQL Server Studio but not via odbc_exec?

The query in the PHP code below works fine when I run it via Microsoft SQL Server Management Studio, but gives Warning: odbc_fetch_into() [function.odbc-fetch-into]: No tuples available at this result index at the odbc_fetch_into call (and does not have any rows). $sql = "DECLARE @ValueList TABLE (CheckValue int) INSERT INTO ...

How do I improve full-text searching

Hello, I have a SQL Server 2008 database. This database has 2 tables: Manufacturer ------------ ID, Name nvarchar(256) Product ------- ID ManufacturerID Name nvarchar(256) My application has a search box. I do not know if the user is going to provide a manufacturer name or a product name. In addition, I'm trying to be a little bit g...

Connecting to MS SQL Server from a cross-platform application

I am working on a GUI application that will be used to perform "manual assessment" of large datasets produced by an AI algorithm. The nature of the assessment isn't important to this question; only the fact that the program will need to periodically check for new data from a server, download it, and then upload the results that the user ...

How to save HTML data in Sql Server

I have feedback panel where user can write HTML formated feedback using AJAX HTMLEditor I want to save this HTML DATA in SQL server HTML SOURCE This is <span style="font-weight: bold; ">nice</span> question HTML OUTPUT This is nice question Now how can i search to my database if your find "is nice" then my query can not respons...

T-SQL - text field to nvarchar

I have a 'text' type in a SQL table (BigNote), and a new nvarchar(2000) field (LittleNote). I need to save the first 2000 characters from the @BigNote into the LittleNote field within a stored procedure. Can someone share some thoughts? Do I need to check for: - nulls? - the BigNote length and only grab the exact amount? It is work...