Display data in a Table
Goal: Display the data of xml in a customized table.The requested table list will be: user firstname lastname hour projectname...
View ArticleMS SQL DBA
Hi,I wanted to implement a scenario in my environment that when ever my Transaction Log grows more than 70% of the particular file system then I will get alert via Email.Please help me to write above...
View ArticleRow count problem with sys.dm_db_partition_stats
One question about sys.dm_db_partition_stats managment view. I have used it to retrieve number of rows for tables in my database. It is working well, but there is problem with some tables that return...
View ArticleWhy doesn't this CASE statement work?
When I run the script below I get the following error:Conversion failed when converting datetime from character string.Why is this happening? It should only be processing the 'varchar' line, right?I've...
View ArticleSQL Syntax for comparing several columns
Hi all,I have a table that I need to compare several columns to se if they are blank. An easy way to do this would be:select 'a is Blank' as Rule, ID from Customers where a=''union allselect 'b is...
View ArticleShould these queries return the same count?
I have Table1 that has 1000 records and Table2 that has 157 records. Table1 has all the records from Table2.Shouldn't these queries return the same amount of records (157)?Thanks.select count(*) from...
View Articlewhat is good row size to speed up the reports
hi, I was making some big tables , so i started considering 8060 max row size, to increase the speed.but noticed that when i keep more number of cols my queries are getting slow even they lare ess...
View ArticleSum Numbers Within String
select COM, co.KEY, ID, DSCD, SECS,EXCNTfrom company cojoinsecurity se on co.KEY=se.KEY where co.KEY=285313 There are strings in DSCD, and some numbers too. I want to sum in the number within the...
View Articlehow to calculate givendate is before last sunday of the month or after the...
in my sql below i am calculating next moday,here in below i passed 7/11/2011 which is monday it will returns 07/18/2011 which is next monday select DaTEADD([day], ((DATEDIFF([day], '19000101', convert...
View ArticleSchema
Dear friends,how can I append some object (table, view) to schema in SQL Server 2008 with using of SSMS. I have prepared a new schema under database Northwind and I d like to append here tables...
View Articlesql query assistance
I want table outTable1 ID Namelink 1 a test1 1 a test2 2 b test32btest43btest3Table2idlinksname1test8a1test1b2test9a2test10b3test11b4test13btable outputidlinkname1test8a2test9a2test10b3test11b4test13b
View ArticleSub-Select with using of operator IN
Dear friends,Can I prepare some Sub Select with using of operator IN in same part of this query?For ex. in DB Northwind. Thanks a lot for answer. Anna
View Articlesql SUM question
I have a table named Trans, and that is the data contained.Customer Product Ordered C1 a 2 C2 b 1 C3 a 1 C1 a 2I wonder a ordered total summary about product 'a' for every single customer, and I use...
View ArticleDynamic SELECT column names
This query works:- Select col_ID,col_Name as Name from TableName But; I want the part after AS (coloumn name) dynamic:- Select col_ID,col_Name as (Select tl_name from Table2 where...
View ArticleDifference between SQL SERVER 2008 & SQL SERVER 2012 & SQL SERVER 2014
Difference between SQL SERVER 2008 & SQL SERVER 2012 & SQL SERVER 2014 ?
View ArticlePushing inserts into SQL server with C# ?
I want to insert about 5000 (typically, can be 10K+ at times) rows into SQL server at a time. My insert statements are generated by a C# program. One way could be by simply generating a big string...
View ArticleSQL 2012 stored procedure help
I seem to be having problems with an SP, can someone assist to debug? The SP runs without error, but values are not written to the destination AnaHistory table.USE [Summary] GO /****** Object:...
View ArticleDate Add SQL Error
I have a field in a table with a date. This date contains the date when a room in a hotel was last cleaned the table in full can be seen here - The date to be cleaned will always be three days on from...
View ArticleGrouping Issue
Hi,Why the SQL below GROUPS at certain times only:SELECT Currency.CurrencyISOCode, Currency.CurrencyCountry, Currency.Currency, Sum(BHDDeliveryDet.Quantity) AS Quantity,...
View ArticleSQL pivot - how do I pivot two columns of data?
I've had a look at similar questions asked but none of the answers seems to fit what I'm trying to achieve.My existing code (with sample tables) is:CREATE TABLE [dbo].[CashDetail]( [MappingMenu]...
View Article