sql-server-2008

How to handle multiple rows in this Sql Server Trigger?

Hi folks, I have the following trigger, but because a trigger needs to handle multiple records, I'm not sure how to correctly handle this, in my trigger code. Can someone please suggest how I can change the TSql below to correctly handle multiple records, instead of just a single record (as is listed, below). Table Schema and defaults...

Linked Server related

I have two instances of SQL Server: Server1 (SQL Server 2008) Server2 (SQL Server 2005) I am executing a stored procedure from Server1 which references tables on Server2. It is working fine in my test environment: Server1 runs Vista SP2, SQL Server 2008; Server2 runs Windows XP SP2, SQL Server 2005. However, it is not working in...

connect sql server 2005/2008 over internet

How do I connect to SQL Server 2005/2008 using Management Studio or other desktop application over the internet? ...

Open SQL CE .sdf in SQL Server 2005 or 2008

Hi, is there a way to import SQL CE .sdf to SQL Server 2005 or 2008? thanks in advance ...

Using a view in one SQL database in another

This is a is it possible question. I have one database file that contains user information, I have another that is for support requests. I want a view of my user data to be used in my support database. to link support jobs to the users. Is it possible to link this information through like linked tables in access and create a view of ...

How to get Microsoft SQL MATH POWER to show as decimal and not as INT (which it seems to do)?

I have this simple query: SELECT POWER(( 1 + 3 / 100 ), ( 1 / 365 )) According to MS SQL POWER(( 1 + 3 / 100 ), ( 1 / 365 )) = 1 when in fact it's 1,000080986 How to get Power to return Decimal instead of int. This topic seems similar to http://stackoverflow.com/questions/429165/raising-a-decimal-to-a-power-of-decimal but that on...

Searching Log Table with Multiple Dimensions

I'm trying to find a more performance way to search a log table. The table logs all searches performed on a site, and can contain multiple filters on a single criteria. For example, users can search for homes in multiple counties, and multiple property types on a single search. I need to be able to run a report to find how many users sea...

Slow query in SQL Server 2008 using linked server. What can I look at?

This query originally came from a VB6 program accessing MS Access tables which are linked to external databases through ODBC. It takes about 3:30 to run. Now I've setup a SQL Server 2008 Express box to evaluate how we can migrate to a better database system. So I setup a linked server to the external server (we call it DWPROD) and when ...

SQL Server 2008 Filestream Win32 error without a network cable!

I have a SQL Server 2008 database utilizing Filestreaming and all works fine and dandy apart from under one very strange circumstance. If i have my database on, say a laptop, on a locally installed version of SQL Server 2008 and am connected to the network all works fine. If i unplug the network cable, after a while the SqlFileStream c...

SQL Insert Query (syntax question)

I have an sql query which is working, it does insert the correct data, but the ID's are out of synch: Dim sql As String = ("INSERT INTO [CANRADcontacts]") & _ (" ([Title], [Initials], [FirstName], [LastName], [Organisation], [Department], [Address], [Code],") & _ (" [Telephone], [WorkTelephone], [Fax], [CellularTelephon...

on ms-sql server, what is the best tool to get all the dependencies between all the objects?

Hi folks, im looking for a tool the get an info for documentation about the dependencies between the objects like tables, views, functions, triggers, procedures. the ssms shows some dependencies but i can't get them out for documentation and as microsoft says thei are not comprehensive. I found a tool-suite "sqltoolbelt" with a module ...

Sql query time jumps from 1 second to over 1 minute if function is used in WHERE clause

I have this query in MS SQL which is acting very weird (at least from my perspective). I've user defined function called: dbo.NajblizszaDataWyceny(3, '2010-02-05') which is simple check for TOP 1 entry in one table joined with couple others. The query itself takes like milliseconds so it's not a big problem, but i show the function any...

Transactional updates that are applied to DB regardless of no commit or rollback

I was under the impression that all updates to a SQL server database are first added the T-Log before being applied to the underlying database. In the event of the server crashing, the restore process would rollback any uncommitted transactions. This I also assumed works with transactions, if a commit or rollback is not called the change...

When OutputCaching is enabled and the session is in SqlServer, the database is hit on every request?

If I had two servers using a single sqlserver instance as the session state, and I enable outputcache in the page, do you know if the database is hit on every request? Since the outputcache is being used to respond the request, I asume is not needed, but if the session is being retrieved before the outputcache flag is checked, then the ...

SqlBulkCopy.WriteToServer not reliably obeying BulkCopyTimeout

I need to count sequential timeout exceptions from SqlBulkCopy. To test this, I use an external app to start a transaction & lock up the target table. Only on the first call does SqlBulkCopy throw a timeout exception when expected. We've tried using an external connection & transaction, as well as using a connection string and internal...

Database access permissions issue (sql server 2008)

I have created a C# app that reads a config file, gets connection strings, and for each connection string it reads list of stored proc for some further processing. Now, I'm facing some permissions issues. When developing the app I was using connection strings with dbo level users. Real life connection strings are for sql users with only...

Image Saving explanation

I have manage to write images on an sql server 2008 But i see that in the image record writing the same bytes in all of the images And also it creates on the remote disk under a special catalogue a file which finally is the image Is there anybody which can explain me the flow chart of writing an image in sql server? What is contain...

SQL Server 2008 + PCI Compliance? Pertains to PCI, as well as Symmetric keys!

I've never had to deal with PCI compliance before. I've been reading their documentation and it says I need to protect the credit card number, expiration date and the card holder's name. No storage of security codes ever. In their documentation, it just says protect. Is this saying I need to encrypt these 3 columns in my database? I...

SQL Server: How to permission schemas?

Inspired by various schema related questions I've seen... Ownership chaining allows me to GRANT EXECUTE on a stored procedure without explicit permissions on tables I use, if both stored procedure and tables are in the same schema. If we use separate schemas then I'd have to explicitly GRANT XXX on the the different-schema tables. The ...

Insert Bytes array INTO varbinary(max) record

I want to INSERT INTO a table in a record varbinary(max) a Byte array How can I do that? ...