Can I use Sql Server functions in myCommand.CommandText and why? Answer If you mean, SQL Server user defined functions. Then, yes; you can use it normally like: The reason it works is because this is the way that functions are called in SQL Server directly.
Tag: tsql
How can I find the dependencies of a multiple objects in sql databases?
sp_depends will provide information for all dependent objects on a particular objects But it is working for only single object , giving information about single object. I want the information about multiple object, How can I achieve it using sp_depend or any other way is there? Answer You want sys.sql_expression_dependencies. This how you get the list of all the dependencies.
Dynamic Pivot Columns in SQL Server
I have a table named Property with following columns in SQL Server: there are some property in this table that certain object in other table should give value to it. I want to make a pivot table like below that has one column for each property I’ve declared in 1’st table: I want to know how can I get columns
T-SQL get number of working days between 2 dates
I want to calculate the number of working days between 2 given dates. For example if I want to calculate the working days between 2013-01-10 and 2013-01-15, the result must be 3 working days (I don’t take into consideration the last day in that interval and I subtract the Saturdays and Sundays). I have the following code that works for
Execute SQL Asynchronously or change locking from Trigger
I have a complex unit of work from an application that might commit changes to 10-15 tables as a single transaction. The unit of work executes under snapshot isolation. Some of the tables have a trigger which executes a stored procedure to log messages into a queue. The message contains the Table Name, Key and Change Type. This is necessary
SQL Server datatypes nvarchar and varchar are incompatible error
I’ve inherited a C# app which I’ve converted to vb. I get one error which as far as I can see has nothing to do with the conversion. I have a SQL statement which is…. SELECT ResolverID AS …
Update one table based upon SUM(values) in another table on multiple criteria
I can’t seem to find out how to do this and not sure exactly how to search for it! I have a table [MASTER]: ID varchar(6) CCY varchar(3) Val1 decimal(20,5) Val2 decimal(20,5) FOO decimal(20,5) and …
SQL Copy row in a table with relations
Hope some one can help me, I would like to copy rows in same table and that table has relation to another table that I have to copy related row accordingly: Table1 I copied rows with table0Id = 3 Table1 I would like to do the same to Table2 depending to the Table1 Ids like this: Table2 Table2 As you
Check if datetime is in current date
I am using SQLServer 2008. I have a table X with field Y that is a datetime format. In the WHERE statement of my query I only want to keep the rows where the date of field Y equals the current date. …
Export database schema into SQL file
Is it possible in MS SQL Server 2008 to export database structure into a T-SQL file? I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedures, user defined types/functions. Also I don’t want the data to be present in this T-SQL file. Is there any way to achieve that? Answer You can