Strip SQL Comments using RegularExpression with C#
Here is the code:
Regex r
= new Regex(@"(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(–.*)");
textBox2.Text
= r.Replace(textBox1.Text, string.Empty);
VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast)
Here is the code:
Regex r
= new Regex(@"(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(–.*)");
textBox2.Text
= r.Replace(textBox1.Text, string.Empty);
VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast)
Worth reading.
URL: http://www.sqlservercentral.com/articles/Performance+Tuning/69337/
VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast)
You just need to do a null checking. Like:
SELECT field1, field2, ISNULL(field3,’’) AS field3
FROM table1
FOR XML AUTO
The behavior is by design. Check more details here: http://support.microsoft.com/kb/296393
VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast)
This is one of my hobby tool which simply connects to a MS SQL Server database and shows all the available tables and its column names. This tool is programmed with Visual C# 2008 Express Edition.
Download from here: http://kidoos.net/media/p/588.aspx
Let me know if somebody needs source code. I have no plans to extend this app [...]
Read the whitepaper here - http://msdn.microsoft.com/en-us/library/cc793139(SQL.90).aspx
extension=php_sqlsrv.dll
The SQL Server 2005 Driver for PHP is a Microsoft-supported extension of PHP 5 that provides data access to SQL Server 2005 and SQL Server 2008. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2008. The SQL Server [...]
When you pass getdate() function as a parameter directly to a stored procedure, you will get an error: Incorrect syntax near ‘)’.
EXEC sp_GetProject GETDATE()
Error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ‘)’.
To avoid this, you will need to create a variable and pass it to the stored procedure. Like this:
DECLARE @dt DATETIME;
SET @dt=GETDATE();
EXEC [...]
One way is to extract from @@VERSION.
Another way is to use exec master..xp_cmdshell ’systeminfo’
One more way will be to use a CLR Function (or stored procedure). Sample below:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString Function1()
{
[...]
The SQL Server 2008 Developer Training Kit will help you understand how to build web applications which deeply exploit the rich data types, programming models and new development paradigms in SQL Server 2008.
SQL Server 2008 offers an impressive array of capabilities for developers that build upon key innovations introduced in SQL Server 2005. The SQL [...]
In Microsoft SQL Server 2008+, it is possible to INSERT something like this (MySQL have this support already have a long time):
INSERT INTO tblTableName (col1, col2) VALUES (‘val1’, ‘val2’), (‘val1’, ‘val2’), (‘val1’, ‘val2’), …
Other methods are:
INSERT INTO tblTableName (col1, col2) SELECT col1, col2 FROM tblAnotherTable WHERE…
INSERT INTO tblTableName (col1, col2)
SELECT ‘val1’, ‘val2’
UNION ALL
SELECT [...]
SQLite error no such table: tblUsers
Most identified reason by me: Connection string problem.
Resolution: Check if you have correct path to your sqlite db.
string ConStr = "Data Source=" + HttpContext.Current.Server.MapPath("AppData\\Desk.s3db") +";Version=3;";
VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast)