sql-server-2005

View SQL Server Table Hierarchy in ms access

I am working on replacing an old ms access system with an SQL server one with a C# front end. Unfortunately I have some die hard ms access users who will be accessing the SQL server tables from ms access but to them it should essentially look the same. When tables are created in ms access and a relationship is created between them they ...

Default column value based on the value of a different column

SQL Server 2005. I have a table with ColumnA bit, ColumnB int Can I add a default value to ColumnB so that ColumnB is 15 if ColumnA is 1 and ColumnB is 0 if ColumnA is 0? I know I could do this with a trigger but I my boss is prejudice against triggers (he needs trigger sensitivity training). ...

How to update GUID in MS SQL via PHP/ODBC?

I've been tasked with getting two MS SQL based products to synchronize. My predecessor was content to match records based on a combination of name and address, but both systems have a GUID, and only one is actually using it. So my thought was to match up my existing records and copy the GUID from one database to the other. But I can't se...

SQL Server: conventions for naming a schema

Consider a database server whose job today is to house one database. Likely the database will be moved in the future to another database instance which houses multiple databases & schemas. Let's pretend the app/project is called Invoicer 2.0. The database is called AcmeInvoice. The database holds all the invoice, customer, and product i...

IsTornPageProtectionOn in Visual Studio Database Edition GDR

Hi all, im having major issues trying to mirror our newly upgrade database solution (to GDR)... specifically the database project settings. when i run a schema compare, i get differences on the IsTornPageProtectionOn variable, however when I go to the settings of the database project this setting is nowhere to be found! i have tried ...

generating log timestamps using Stored procedures in SQL server 2005

I have a Stored Procedure, Which has some select Statements and insert statements. Is there any way , I can log the Timestamps of execution before and after the sqls inside the Stored procedure? ...

How do i retrieve a value output from a stored procedure using: OUTPUT INSERTED.BrandDrugDetailsID

I have a storeprocedure: CREATE PROCEDURE [dbo].[BrandDrugDetailsInsert] @BrandDrugDetailsID uniqueidentifier OUTPUT, @BrandDrugID uniqueidentifier AS BEGIN INSERT INTO Pharmacy_BrandDrugDetails(BrandDrugID) OUTPUT INSERTED.BrandDrugDetailsID VALUES (@BrandDrugID) END Anytime i try to retieve the value "@BrandDrugDetai...

How to get number of rows inserted by a transaction.

I have to manage a log where i have to see the number of rows that are inserted by a transaction. Is there any way of doing it dynamically ? ...

How can we dis-connect all the active users on sql-server 2005 express using sql

How can we dis-connect all the active users on sql-server 2005 express using sql ...

How do I GRANT ALTER ANY LINKED SERVER to a role?

Our database has a named database role. Our service account is a member of this role. This makes our database creation scripts simpler. However, I'd like this role to be able to create linked servers. If I try the following: USE OurDatabase GO GRANT ALTER ANY LINKED SERVER TO OurRole GO ...it fails with Permissions at the server sc...

inline blob in sql server

hi have a record whose hex dump is follows 00000000: 30001100 013caae4 62010000 00000000 †0....<..b....... 00000010: 00060040 02002000 5c803801 02000000 †...@.. ..8..... 00000020: 0400004d 01000000 384c0000 681f0000 †...M....8L..h... 00000030: e7010000 01000000 d03e0000 08020000 †.........>...... 00000040: 01000000 385e0000 09...

How to take the backup of live sql server 2005 express DB

How to take the backup of live sql server 2005 express DB ? At any given time some transaction are in progress. ...

Tweaking the Fill Factor to reduce fragmentation

I have an non-clustered index that has ~1000 pages, 95% fragmentation and a FillFactor of '0'. I rebuilt the index on Sunday. A week later, the index has 95% (or so) fragmentation again. Is this an indication that I need to change the FillFactor to say 80-90%? Should I be tweaking the fill factor each week to see if I can reduce the ...

Does the sequence in which we use join in a query effects its execution time ?

Does the sequence in which we use join in a query effects its execution time ? ...

How Often should the indexes be re-build in sql-server DB ?

Currently we are having DB of size 10GB and it is growing by around 3GB a month. Often I have come to hear that one should from time to time rebuild the indexes so as the improve the query execution time. So how often should i re-build the indexes in the given senario ? ...

SQL Server 2005, SQL Driver for PHP v1.1 eats "Transaction doomed in trigger" errors

short version: the sqlsrv driver (Native Client wrapper) "eats" constraint violation errors generated from triggers; the mssql driver (ntwdlib wrapper) reports them just fine. SQL Server 2005 PHP 5.3.1 SQL Server Driver for PHP 1.1 fixture: CREATE TABLE t ( t INT NOT NULL PRIMARY KEY ); CREATE VIEW v AS SELECT CURRENT_TIMESTAMP ...

Faster way to get an SQL-compatible string from a Guid

I noticed this particular line of code when I was profiling my application (which creates a boatload of database insertions by processing some raw data): myStringBuilder.AppendLine( string.Join( BULK_SEPARATOR, new string[]{myGuid.ToString() ... Bearing in mind that the resultant string is going to end up in a file called ...

In C#, convert Sql Server 2005 datetime value to another timezone

UPDATE I am dealing with a legacy database where the datetime values have been stored in a specific timezone (not UTC). Assume it is not possible to change how we are storing these values. END UPDATE Say I have a SQL Server 2005 database with a table as follows: [id] (int) not null [create_date] (datetime) not null Suppose my [c...

How we can zip text files via Integration service project?

i created a package in SSIS 2005. this package export my tables from sql server 2005 to text files daily. on the other hand i created another package for uploading these text files to FTP site. but the size of my text files becomes bigger and bigger day by day. i have to zip them and after that upload to FTP. would u please advise me? t...

Sql 2005 runs my query on a single CPU and thus is slow

I have a query which joins 6 tables, produces 800,000 rows, and inserts them into a table. I'm running this query on Sql 2005 Standard on an 8-core machine, on which there is no other workload running. The Sql service uses only one CPU core while running this query (using that CPU for 100%), and this way the query runs for almost 4 minu...