sql-server

export user rights into a SQL file for SQL Server

I would like to know if there is a query to export the user rights select insert grant and so on, to a SQL file. I managed to get the list of the Grants: Select * from INFORMATION_SCHEMA.TABLE_PRIVILEGES ...

SQL Server 2000+ which column type to use for storing blobs?

I have to store blob data roughly 10MB per record. Which column type and size should I use for the field? ...

"Silent" errors in .ADP with SQL Server

I have an adp project in MS Access 2003 with an SQL Server Express 2008 as backend. Everything works fine, except when there is an error on the SQL side, e.g. duplicate indices. the current dataset just doesn’t get updated/inserted, no error message whats-o-ever, but I know it’s not updated, because if I do a select on the server I stil...

OsVersionCheck failed when installing SQL Server 2008 Express on Windows 2003 SP2 Datacenter Edition

I have a VPS at a hosting company and it runs Windows 2003 Datacenter Edition. I just recently installed SP2 for Windows. When I try to install SQL Server 2008 Express the minimum requirements fails. According to Microsoft the OS Version I have should be supported. http://msdn.microsoft.com/en-us/library/ms143506.aspx#Express32 When v...

Edit TOP Row in SQL Server Management Studio

When I right click on the table, I get the option to Edit TOP 200 rows. I went to option and changed this to TOP 1 row. Now when i open that row, that is not the latest but the last row of my database. How can I Edit the latest row inserted in my table? ...

Deploy unsafe sql server 2005 assembly to production

Hey, I'm new to SQL Server development and I need to deploy an unsafe UDF assembly to a 2005 server. I'm using C# and VS2008. I need to know what are the steps that i need to take to allow smooth deployment of unsafe assembly to the client's machine - the client's DBA is a very strict fellow so i need to satisfy him with a good reasons f...

GUID versus Int

If you have a table with at most 10 records and it is referenced in lots of other tables( Via FK relationship) with at least 1,000,000 records in each table . What will you recommend for type of PK( GUID or tinyint ), if replication is never going to be used? I have bump into this page with followng excerpt: Guids on SQL Server can...

Update an NText Column

In my NText column, I have some data in between <script type='text/javascript'> </script> tags. I want to replace all the data between <script type='text/javascript'> </script> tag with this data below: <!--//<![CDATA[ var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php'); var m3_r ...

How to convert mdb to mdf Database in Sql Server 2000

Using SQL Server 2000 and Access 2003 I want to convert the database from access to sql Database. There is possibility in sql server 2000 or any other tools is available. Need Help ...

SQL Stored Proc : How to pass a collection of files to a stored proc?

My program has code that saves attachments, I want these attachments to be transferred to the database, and I am going to use a stored procedure to accomplish this. I need to know what is the @param type to accept an array of binary files? finally once I have this array, how to I insert this data into a SQL table? I guess I am lookin...

How to query Open-high-low-close (OHLC) data from SQL Server

Hi, I'm trying to retrieve data for a Open-high-low-close (OHLC) chart directly from the database, it's the kind of chart you see of stocks. Is this possible, and if, how? I have a table like this (simplified): Date | Price | PriceType A record is created for each day, I will report per month / year, not per day as used for stocks. ...

Searching in Nvarchar(max)

I am searching for the following string in a nvarchar(max) column <script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;amp;source However when I use CharIndex and try to find, I get 0 How can I search for that string? I am using SQL 2008 ...

inserting values into master and transaction table at the same time

Hi, After inserting into masterTable it returns an ID. With that ID I want to enter more than one row into a transaction table. I am using two separate procedures. The problem is, after inserting the record into master, and while inserting into the transaction table, if any interruption occurs I want to abort the corresponding insert o...

Ensure data integrity in SQL Server

I have to make some changes in a small system that stores data in one table as following: TransId TermId StartDate EndDate IsActiveTerm ------- ------ ---------- ---------- ------------ 1 1 2007-01-01 2007-12-31 0 1 2 2008-01-01 2008-12-31 0 1 3 2009-01-01 2009-12-31 1 1 4...

SQL Server - SELECT FROM stored procedure

Say I have a stored procedure that returns rows: CREATE PROCEDURE MyProc AS BEGIN SELECT * FROM MyTable END Of course my actual procedure is a little more complicated, being why a sproc is necessary. Is it possible to select the output from calling this procedure? Something like: SELECT * FROM (EXEC MyProc) AS TEMP The reason...

Installing support files for app using sql 2005 where server is on another computer.

I have a managed C++ application that connects to SQL Server 2005 Express databases on the same computer and over a network. My problem is that if the database is located on another computer over the network, the client machine will not have the needed DLLs files installed from SQL Server. I can't force my users to install SQL Server 20...

Return all Fields and Distinct Rows

Whats the best way to do this, when looking for distinct rows? SELECT DISTINCT name, address FROM table; I still want to return all fields, ie address1, city etc but not include them in the DISTINCT row check. ...

Optimize multiple joins with table functions

I would like to join several times with the same table function for different input variables in the same query. But this turns in my case out to be much slower than using table variables and selecting from the table functions separately. How can I avoid table variables and still have a fast query? For example, we have a SQL query like...

Setting a column to varchar(256), will this waste more space if all content is maximum 100?

If I know that a table column only really needs to be varchar(100) i.e. data will not be longer than 100 characters, if I set the column to be varchar(256) will it make any difference? From what I understand, since the column allows for variable length, having it at either 100 or 256 won't make any different so long as the data is never...

Sorting with sql server and collation and unicode.

Hi I've got a table in sql server, and one of the columns is used to store multilingual data, it's current nvarchar(250). When sorting the column on the web front end I would like to take the user's locale into account so e.g spanish is sorted correctly taking "ch" into account. I'm a bit lost in how to do this. Can anyone point me i...