sql-server

SQL Server: Can I set a trigger on ALTERing a stored proc?

Everytime a stored proc is ALTERed or CREATEd, I want to capture that in a trigger to do some stuff afterwards. Can I do that in SQL Server 2008? Thank you. --Beemer ...

Giving precedence/weight to a column using FREETEXTTABLE

I am using SQL Server Full Text Search, with the keyword FREETEXTTABLE to return a table of results based on a few columns, searching for a keyword. Now I have 2 main columns that I am searching on, Title and Description, I want to give precedence to the Title column as this will most likely have my results but Description might contain...

Can I use Truecrypt to protect an SQL 2008 database so that only my application can see the data?

I want to distribute an SQL 2008 database to a client and set it up so that the only way to access the data in it is through my application. Can I use Truecrypt for that? Can you think of any other solution? ...

Why Does SQL Update Top apparently reduce locking even when no records are updated?

I have a question about why some SQL (running on SQL Server 2005) is behaving the way it is. Specifically, I made a change to reduce lock contention during an update and it seems to be working in cases I didn't think it would. Original code: We had an update statement like this, that was being applied to a table with more than 3,000,0...

how can i see data in mdf file.

i have asp.net application. it has App_Data folder. this folder contain mdf and ldf file. how can i see data within these file. i want to see table structure. ...

Exporting database dump via phpMyAdmin to MS SQL

When I use the phpMyAdmin export, it has an option for MS SQL export compatibility. However, the resulting file includes many non-MS SQL compatible items, such as mediumtext and enum datatypes. How do I work around this issue? ...

SQL string not line breaking in gridview

I have this string in some sql: FT_TBL.Title + CHAR(13) + 'Job:' + str(FT_TBL.JobName) as Title Now the Title is parsed as a boundfield in a c# gridview, the first row puts "Job" on the next line, but after that its random, some lines are next line some aren't! Any ideas? ...

Database Locking Problem

Hi All, Pls. we've been getting A LOT of locks on a production database that's recently witnessed substantially increased traffic. We are using IdeaBlade for most of the data access. I got the following trace using Sql Profiler: deadlock victim="process84af28" resource-list keylock hobtid="72057594096451584" dbid="6" objectname=...

How do I specify "close existing connections" in sql script

I'm doing active development on my schema in SQL Server 2008 and frequently want to rerun my drop/create database script. When I run USE [master] GO IF EXISTS (SELECT name FROM sys.databases WHERE name = N'MyDatabase') DROP DATABASE [MyDatabase] GO I often get this error Msg 3702, Level 16, State 4, Line 3 Cannot drop database "My...

Create a before delete trigger?

id country_name region area population 1 LASvega Americas 2314 2134562 2 California AMERICAS 10101 2134562 3 Algeria Middle East 24000000 32900000 4 Andorra Europe 468 64000 fire a delete query , just before that this trigger is fired an...

Mode Statistical Aggregate Function in sql server Reporting Services 2008

I am trying to compute Mode along with a bunch of other aggregates (SUm,Min,StdDev) on a report. Currently there is a Row Group and a Column group. The row Group is by region and the Column Group is based on the results from a column. Following an tutorial online, I got this custom code working for it. Dim values As System.Collections...

almost newbie sql question

can you run ansi sql statements in sql server express 2005 or 2008? ...

Using Data Source Configuration Wizard from Source View?

I'm developing an asp.net site over a pretty slow network. The "Design" view of the remote Visual Studio doesn't work via Remote Desktop Connection-- and this is the only way I've seen in the docs to open the Data Source Config. Wizard. Is there a way to invoke the Data Source Config. Wizard from the source view? Thanks ...

What's the difference between "::" and "sys" schemas?

As far as I know, BOL exmaple on fn_trace_getinfo used to use :: instead of sys schema in the example like following From SELECT * FROM ::fn_trace_getinfo(default) To SELECT * FROM sys.fn_trace_getinfo(default) Are there any differences between those two? And what does :: mean? ...

What does varchar(-1) mean?

What is the meaning of varchar(-1) in SQL Server 2008? Is it an alternative for varchar(max)? ...

Trunc(sysdate) in SQL Server

What is the equivalent of: TRUNC(SYSDATE) ...in SQL Server 2005? ...

Can only connect to SQL Sever 2008 Express remotely afer server restart

I am running SQL Server 2008 Express and can connect to it fine using port forwarding through my router, AND when I am on the same subnet. However when I am on a different subnet, I can only connect to it right after I restart the SQL Server Agent. After the restart, I can connect to it, however if I close the connection, I have to res...

SQL Server Stored Procedure Fails due to use of XML/ ANSI_NULLS, QUOTED_IDENTIFIER options

I have a stored procedure which takes an XML parameter and inserts the data into multiple tables. If I run the stored procedure into a database using a SSMS query window, everything works fine. However, we have a custom installation program that is used to deploy stored procedures to databases, and when this is used, execution of the sp ...

SQLServer 2008 - Configuring Service Broker between instances

Hi, I've been using the scripts from this website to help configure Service Broker based auditing. The first stage - setting up SB between databases on the same instance works fine. But then, when I try to apply Service Broker between instances, I'm running into grief. I'm using the command line tool, ssbdiagnose to help me find the c...

Sql Server Compact Edition 3.5: Does the data persist in the database file?

Hi guys, I have this question in which I have a SQL Server Compact Edition database for a desktop application. I am completely new to Sql Server Compact Edition. The question is, does the data inserted in the database persist even if the application is shut down or restarted? Coz I cant seem to find my data when using Sql Server Manageme...