sql-server

How to retrieve error when launching sqlcmd from C# ?

Hi all, I need to run a stored procedure from a C# application. I use the following code to do so: Process sqlcmdCall = new Process(); sqlcmdCall.StartInfo.FileName = "sqlcmd.exe"; sqlcmdCall.StartInfo.Arguments = "-S localhost\\SQLEXPRESS -d some_db -Q \":EXIT(sp_test)\"" sqlcmdCall.Start(); sqlcmdCall.WaitForExit(); From the sqlcm...

SQLGetData issues using C++ and SQL Native Client

I have a C++ application that uses SQL Native Client to connect to a MS SQL Server 2000. I am trying to retrieve a result from a TEXT column containing more data than the buffer initially allocated to it provides. To clarify my issue, I'll outline what I'm doing (code below): allocate buffer of 1024 bytes use bind buffer to column us...

HashBytes() Function T-SQL

What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()? ...

Bootstrapper for SQL Server Express 2005 64 bit

Where can I get the 64 bit bootstrapper for SQL Server Express 2005 64 bit. The default bootstrapper is 32 bit only. This will not install on Vista 64 bit. ...

Missing SQL Service stored procedure

I am receiving a message from a commercial program stating that the "LogMessage" stored procedure is not found. There does not appear to be a stored procedure called LogMessage in the associated MS SQLServer 2000 database. What can I do to track down the missing procedure, other than calling the company? ...

How to convert DateTime to VarChar

I am working on a query in Sql Server 2005 where I need to convert a value in DateTime variable into a varchar variable in 'yyyy-mm-dd' format (without time part). Please help, thanks. ...

How can i combine two columns containing Richtext data/files

What is the best way to maniupulate richtext / *.rtf data in SQL server 2005 / 2008 I have looked at ocx solutions. Maybe creating some CLR stored procs?? The problem is that I have several notes written in richtext that need to be combined for ease of reporting. Like SELECT @Notes = @Notes + RTFColumn FROM Notestable WHERE ... ...

What datatype should be used for storing phone numbers in SQL Server 2005?

I need to store phone numbers in a table. Please suggest which datatype should I use? Wait. Please read on before you hit reply.. This field needs to be indexed heavily as Sales Reps can use this field for searching (including wild character search). As of now, we are expecting phone numbers to come in a number of formats (from an XML...

What is the easiest way to get total number for lines of code (LOC) in SQL Server?

I need to provide statistics on how many lines of code (LOC) associated with a system. The application part is easy but I need to also include any code residing within the SQL Server database. This would apply to stored procedures, functions, triggers, etc. How can I easily get that info? Can it be done (accurately) with TSQL by queryi...

Force numerical order on a SQL Server 2005 varchar column, containing letters and numbers?

I have a column containing the strings 'Operator (1)' and so on until 'Operator (600)' so far. I want to get them numerically ordered and I've come up with select colname from table order by cast(replace(replace(colname,'Operator (',''),')','') as int) which is very very ugly. Better suggestions? ...

What are the major new 'core' features of MS SQL Server 2008?

I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... ...

Improving SQL Server performance on VMware under Linux

I have a Linux server in a small company (3 users) acting as a domain server and running two VMs under VMware: one has SQL Server 2000 on it and one has SQL Server 2005, in each case running on Win2k. Each of the SQL Servers has a couple of small-but-important databases. As near as I can tell, the Linux server spends its life utterly b...

Which type of external drives are good for SQL backup files?

As a part of database maintenance we are thinking of taking daily backups onto an external/firewire drives. Are there any specific recommended drives for the frequent read/write operations from sql server 2000 to take backups? ...

Why does Sql Server keep executing after raiserror when xact_abort is on?

I just got surprised by something in TSQL. I thought that if xact_abort was on, calling something like raiserror('Something bad happened', 16, 1); would stop execution of the stored procedure (or any batch). But my ADO.NET error message just proved the opposite. I got both the raiserror error message in the exception message, plus ...

Free/cheap PowerDesigner alternative?

We are using PowerDesigner at work for database modelling. But there is a hell of a price tag on that piece of software. And frankly, all I use is physical diagrams for MS SQL, which is about 1% of what PD knows. Are there any good alternatives? I know about Visio and MS SQL Diagrams, but looking for other options. ...

How to prevent an Insert query from enrolling into a Distributed Transaction?

I have a SQL Insert query inside a stored proc, for inserting rows into a linked server table. Since the stored proc is getting called within a parent transaction, this Insert statement tries to use a DTC for inserting rows into the linked server. I would like to avoid DTC from getting involved. Is there any way I can do that (like a ...

Scaling cheaply: MySQL and MS SQL

How cheap can MySQL be compared to MS SQL when you have tons of data (and joins/search)? Consider a site like stackoverflow full of Q&As already and after getting dugg. My ASP.NET sites are currently on SQL Server Express so I don't have any idea how cost compares in the long run. Although after a quick research, I'm starting to envy ...

Troubleshooting Timeout SqlExceptions

I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql command timeout to sixty seconds, but as I've found, this doe...

Stored procedures/DB schema in source control

Do you guys keep track of stored procedures and database schema in your source control system of choice? When you make a chance (add a table, update an stored proc, how do you get the changes into source control? We use SQL Server at work, and I've begun using darcs for versioning, but I'd be curious about general strategies as well ...

Sql Server compatibility mode

We're currently running a server on Compatability mode 8 and I want to update it. What are the implications of just going in and changing it? What is likely to break? Is there anything that checks the data will survive before I perform it? Can I rollback to mode 8 without performing a restore and without loss of data? ...