Replacing Null Values With Another Column
I have a view that is joining a mapping table with a data file and joining on the account (format:11111111-2222-333) string and returning [Entity], [Mapped_Account], [Department]. However, they are...
View Articlehelp with tsql Nchar to date
Region(char)NorthSale_Date(Nvarchar)04/02/2014Sale_Month(Nvarchar)04/2014Sale_Amt(int)10Sale_Date(Nvarchar)04/12/2014Sale_Month(Nvarchar)04/2014Sale_Amt(int)30Region(char)EASTSale_Date(Nvarchar)04/02/2...
View ArticleBest way to Share Data Between Stored Procedure and trigger
suppose i am calling a Stored Procedure and sending some params. the Stored Procedure will update a table and a trigger is there for that table. so when Stored Procedure update table then i want which...
View ArticleSelect of a child table return double number of rows than it should
Hi,I have this code: string prname = Console.ReadLine(); SqlDataAdapter spjadap = new SqlDataAdapter("select * from spj", connString); spjadap.Fill(ds, "tab"); DataColumn parentcol =...
View ArticleHow can I use the join condition for this query?
Hi, i am using a query which has a sun query in it, wen i am running tat query it is giving 9332 records, I changed the sub query logic and given an inner join, but it is giving only 4476 records. So,...
View ArticleDate between
Hi i want to display date value like ''01-May-2014' to '01-july-2014'.in my column result i want to show likeMay-2014June-2014....July 2015how to do this in sql server..i dont want to use Union...
View ArticleI have a varchar col , want to find that the value's datatype which is stored...
Hi, I have a column in database , whoes type is varchar. i store numbaric and char data in it.now i want to update all char value with some new value , how can it be performed in single...
View ArticleFinding all indexes in the server. (all databases)
Hi Guys,How to get list of indexes in the server including all databases?Please advise.Appreciate your help!
View Articlehow to get datatype a column in sqlserver ?
hi allI want have datatype a field in sqlserverhow to get it with (T-sql)thank you
View ArticleThe definition of object has changed
SQL 2008 R2I have a sproc that runs daily. Every week, at least once, I get the error that "The definition of object 'xxx' has changed since it was compiled." The sproc hasn’t changed in months. The...
View ArticleYou can be our next Spring T-SQL Guru !!
In the northern hemisphere at least, Spring is here! (apparently)And at TechNet Wiki, we're hoping you're all hatching new ideas for this month's TechNet Guru competition!We're looking for more shoots...
View ArticleString Contains -- Return Left Right
Hello,I have this sample query that returns a beginning length of text.Sample DataCREATE TABLE [dbo].[SampleTable]( [Id] [int] IDENTITY(1,1) NOT NULL, [TextColumn] [nvarchar](500) NOT NULL, CONSTRAINT...
View ArticleScalar function For Identity Or Row Number
HiI need to create a scalar Function that works in the same way as Row Number or a Identity columnI've not really used functions before so what would be the best way to do this?Regards
View ArticleHow to rename a column name while copying it from another table
Hi All,I am copying rows between two table TableA to TableB but I wanted to insert data in he column name (username) in tableA to a column named (NewUser) in tableBHow do I go about that?insert into...
View ArticleDrop User and Create User on db
Hi,Currently we have db's that are versions of our intranet db's on a different server. We have been experiencing problems with the main User on those duplicate databases after an backup and restore...
View ArticleHow do I calculate the size of files that I have UNC paths for
I am on SQL Server 2008 R2. I have a table that contains a field called [Location]. In that field is a UNC path to the physical file on the repository. Is there a way in SQL Server that I can say give...
View ArticleSSISDB VS MSDB VS FILE SYSTEM
Hi,Does SQL server 2012,no more prefer MSDB and File system deployments?If not migrated what are implications in future??is it really necessary to upgrade now??when I use Smo, why does my package...
View ArticleSelect with Case union / Conditional selection
Hello Could you please help me with this issue,in this selection when there is partciluar segment found in the selection then need to add 2 records per segment otherwise just selected results--Drop...
View ArticleHow do I find which database a stored procedure exists
If I have, say, a dozen databases on a database server and am looking for a specific stored procedure without knowing which database it can be found, is there a way to query all of the databases to...
View ArticleRepair SQL database that has been marked suspect
I woke up this morning to find my company's SQL database inaccessible and marked suspect. I have used various t-sql commands to bring it into Emergency mode. Now it is labelled...
View Article