MS SQL server casting without exception

Is there any “convert” function in MS SQL server that allows to cast types safely(without throwing exception). I need something like “tryParse” in C# lang but as SQL statement. More detailed, I need the following statement returns zero or any else but throwing exception. select convert(float, ‘fjsdhf’) thanks in advance.

Composite Clustered Index in SQL Server

I have a table with a IDENTITY Column as Primary Key (a classic ID column). SQL Server create automatically a Clustered Index for that Primary Key. My question is: Can I have a only single CLUSTERED INDEX composite with more columns? If yes, how can I drop the default clustered index and recreate a new […]

Getting count of related tags

I recently asked this question to get related tags like in Stack Overflow: what is the query to get "related tags" like in stack overflow I would like to show the count like in Stack Overflow, so with each related tag, what is the count of this other tag on questions with the first tag? […]

SqlDependency subscription not dropped from dm_qn_subscriptions on shutdown

My SqlDependency works fine, and the Broker Queue and Service get dropped properly when the application exists (I do execute SqlDependency.Stop(…) as recommended before terminating the process), yet I notice that the notification subscription created by the SqlDependency lives on in the table “sys.dm_qn_subscriptions” after the application shuts down. If I later (post-app shutdown) execute […]

JDBC SQL SERVER: The statement did not return a result set.

Hi i have this sql request: SELECT * INTO #temp_table FROM md_criteria_join WHERE user_name = ‘tecgaw’ UPDATE #temp_table SET user_name = ‘tec’ WHERE user_name != ‘tec’SELECT * from md_criteria_join WHERE user_name = ‘tec’ and view_name not in (SELECT view_name FROM md_criteria_join WHERE user_name = ‘tecgaw’) UNION SELECT * FROM #temp_table ORDER BY view_name, user_name, crit_usage_seq, […]

Is there a way for viewing the recent expensive queries in Sql Server 2005?

I recently found out about the activity monitor in SQL Server 2008 (I know, duh, right?). The tab “recent expensive queries” helped me quite a lot. Now I’m trying to debug an overuse of the database in one client, but the server there is SQL Server 2005. There is an Activity Monitor there, but not […]

How do I create connection string programmatically to MS SQL in Entity Framework 6?

How do I create connection string programmatically to MS SQL in Entity Framework 6? I’m using c# and WPF and I was wondering if someone could show me how or link me to a resource that shows how to set up connection strings programmatically in EF 6. The MSDN article explains that you can […]

Database size limit for SQL Express Edition

I am new to be SQL Server so I have read that the database size limitation of MS SQL Server 2008 Express Edition is 10 GB. Now my question is can I have multiple databases like Database A with 8 GB and Database B with size 10 GB. I mean is the size limitation for […]

SELECT FOR XML AUTO and return datatypes

During playing with sys.dm_exec_describe_first_result_set I get to this point: CREATE TABLE #tab(col INT, x XML ); INSERT INTO #tab(col,x) VALUES (1,NULL), (2,NULL), (3,'<a>x</a>’); SELECT ‘Simple XML’ AS description, name, system_type_name FROM sys.dm_exec_describe_first_result_set( N’SELECT col FROM #tab FOR XML AUTO’, NULL, 0) UNION ALL SELECT ‘Wrapped with subquery’, name, system_type_name FROM sys.dm_exec_describe_first_result_set( N’SELECT(SELECT col FROM #tab […]

Display DataType and Size of Column from SQL Server Query Results at Runtime

Is there a way to run a query and then have SQL Server management studio or sqlcmd or something simply display the datatype and size of each column as it was received. Seems like this information must be present for the transmission of the data to occur between the server and the client. It would […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.