sql-server-2008

Synchronizing two Sql Server 2008 databases in same instance

Hi All I want to synchronize two databases (DB1 and DB2) present in same instance. Lets say if i create a table or make any changes to a existing table (e.g. altering the structure) in one database DB1, those should be reflected on the other database DB2 Please help Savitha ...

Bulk DELETE on SQL Server 2008 (Is there anything like Bulk Copy (bcp) for delete data?)

Is there any solution for bulk delete in SQL Server? I can't use TRUNCATE because I want to use WHERE for limiting the rows in action. Is there anything like Bulk Copy (bcp) for delete data? ...

how to convert text to date in sql server 2008 ?

hi i have table that contain A text field [nvarchar(10)] how to convert this field to date ? when i try to change in the field in the design mode - i get this: Unable to modify table. Conversion failed when converting date and/or time from character string. is there any query that i can run to do it ? thank's in advance ...

problem with convert text to time in sql server 2008 ?

hi i have this Ttime as nvarchar(10): "09:52:48" and i have TmpTime as date and i try to convert like this: "UPDATE MEN SET TmpTime = CONVERT(DATETIME, Ttime ,108 )" and i get in TmpTime this: "1900-01-01" why ? thank's in advance ...

How can I format datetime values in SQL Server?

hi How can I format the following datetime values: 2010-01-21 00:00:00.000 - as - 21/01/2010 and 1900-01-01 09:09:18.000 - as - 09:09:18 ...

Sql Server Mgmt Studio: is there a way to get it to reuse windows?

This is more an annoyance than a real problem, but it would be great if someone had a trick to get it to work. Let's say I have a .Sql file, MyScript.Sql. If I go to the file location in Windows Explorer and double click it, it opens SSMS. Good, that's what I want. However if I double click on that file again (or a different .sql file)...

SP takes forever to run in SSIS

Hi there, This is my first question so bear with me, i will also attempt to answer one somewhere if i can as payment, though not sure my skills are up to it yet. I have a stored procedure in SQL 2008 that at the moment executes with a result of about 600 odd rows, it has unions within it and a user defined function used multiple times....

SQL - select distinct records in one field with highest records from another field

In a scenario where I have a table like so: int id (PK) int staff_id int skill_id bit mainskill I want to select only ONE record for each staff member (represented by staff_id) listing their main skill as represented by a (1) in mainskill. If no main skill is present, I want to return any of the skill records for that staff member. Fo...

Create Sql Server Backup on Local Machine

I am using SQL Server Management Studio running on my local machine. I can log on to a remote box (database engine) and use the Studio to create a database backup which is saved to a drive on the remote box. How do I get it to save the backup to a drive on my local machine? ...

Strange behaviour when renaming a column in SQL Server 2008

I need to write some code for renaming a column in SQL Server 2008. When scripting that in Management Studio I got a double renaming : NAME1 ==> TEMPNAME ==> NAME2 BEGIN TRANSACTION GO EXECUTE sp_rename N'dbo.Table_1.columFirstName', N'Tmp_columSecondName_2', 'COLUMN' GO EXECUTE sp_rename N'dbo.Table_1.Tmp_columSecondName_2', N'colum...

Handle sql-server permissions gracefully with Navision

Background I am in the process of creating an application (referred to as MyApp) which must read data out from a SQL Server database handled by Navision. Navision users should to be able to use my application, without modifying permissions in the database. Navision's handling of permissions seems to be on the application layer. It perf...

Cannot create a row of size 8064 which is greater than the allowable row size of 8060

I've have this strange problem when adding a column to an existing table. The existing table looks like : CREATE TABLE [BinaryAssets].[BinaryAssets]( [BinaryAssetId] [int] IDENTITY(1,1) NOT NULL, [BinaryAssetStructureId] [int] NOT NULL, [Name] [nvarchar](max) NOT NULL, [Created_By] [int] NOT NULL, [Created_On] [bigint] NOT NULL, ...

have truncate and drop index better performance than drop table, create tale and create index?

I have a simple question: Scenario: Whose Perfomance is better ? 1) DROP INDEX --> TRUNCATE TABLE --> AND THEN FILLUP DATA --> AND THEN CREATE INDEX 2) DROP TABLE --> CREATE TABLE --> FILLUP DATA--> CREATE INDEX I am using a table with millinos of recods. Which of these queries would suit my needs best? ...

Cannot modify maintenance plan in SSMS

I'm running several Maintenance Plans on my SQL Server 2008 SP1 Standard installation. I'm running SQL Server Management Studio on both my development machine and a copy of it on the server. On either box, if I try and modify any of the existing Maintenance Plans or select "New Maintenance Plan...", nothing happens. The only solution th...

nvarchar(max) vs NText

What are the advantages and disadvantages of using the nvarchar(max) vs. NText data types in SQL Server? I don't need backward compatibility, so it is fine that nvarchar(max) isn't supported in older SQL Server releases. Edit: Apparently the question also applies to TEXT and IMAGE vs. varchar(max) and varbinary(max), for those searching...

Run SQL Server Agent and Database Engine as Network Service or System

It's been a long time since I've had to install SQL Server. I'm doing it for a source control system called Plastic SCM on my system. I'm about to finish the wizard asking me a plethora of questions, and I'm at the Service Accounts tab under Server Configuration, it's asking me if I want to use NT AUTHORITY\NETWORK SERVICE or NT AUTHOR...

Why isn't my Data Mining Model Training destination accepting numeric input inside SSIS?

I'm trying to create a mining model for forecasting against some DW data. I'm using SSIS for my ETL, and trying to use the Data Mining Model Training destination. Unfortunately I'm receiving an error whenever the column I'm trying to predict is numeric or decimal format. I don't get the error when I create the model by hand in SSMS, a...

Question on Converting ints to datetimes in TSQL

I have a stored procedure that takes an int for the desired month and year as parameters. It uses these to compare some datetime values from the tables I'm pulling from. I need to conver them into DateTime values. I'm trying to do something like this: CONVERT(DATETIME, CONVERT(varchar(4), @year) + '-' + Convert(varchar(2),@month) + '-01...

Sql Server CE 2.0 RDA on IIS 7 and Sql Server 2008

I am trying to get SQL server CE 2.0 RDA that was working on IIS6 (Server 2003) and Sql Server 2000 moved to a Windows 2008 server with IIS and SQL server 2008. Is this something that is possible? It seems that there is no fundamental reason that it would not. The target database is not changed since the migration. My first problem i...

Sql Server 2008 Cross-database table linking (relationships)

Hi guys, I have a bit of an issue, and to be honest I don't think there's an answer, but I'll give it a try anyway. So I have two databases [A]->Company and [B]->Product. Both databases have a Country table which is then linked to other tables in each individual database. The problem is that the data between the two Country tables is a ...