Using LIKE operator doesnt return results
HiI'm very new to SQL and databases in general. I have a vb.NET app in which I'm trying to send a SQL server to a SQL Server 2012 server.For testing purposes Im using SQL SErver Management studio. I...
View ArticleChecking Sum of count is greater then certain number
I have a query SELECT `TELCOID`, COUNT(*) smsCount FROM `smsout` WHERE `STATUS` = 'Send' AND (RECEIVEDTIME BETWEEN DATE_SUB(NOW(), INTERVAL 1000000 MINUTE) AND NOW()) GROUP BY `TELCOID` My result is...
View ArticleConcat Cols in Dynamic SQL
HiI'd like that @cols became one column (concat @cols) with name DESCRIPTION but I don't understood how to do!!You can help me!?USE [Pippo] GO DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX),...
View ArticleDeleting Would Not Delete Records
Hi All,I have a stored proc that has inserts, updates and delete records from a table. After running the stored procedure, the records that needs to be deleted are still in the table. I created another...
View ArticleSQL Server Procedures Questions
Hello, I needed some simple help in SQL Server, given below are my two questions.I am looking at making a SQL Server Procedure which uses cursors to detect some data entry mistakes. 1) I have a query...
View Articlewhat are the key requirements to write a recursive cte?
what are the key requirements to write a recursive cte?when we will go for a recursive cte.
View ArticleQuery All Views
I know how to query one view/table to determine if it contains a field, but how can I query all views and get a listing of the view names that do not contain a field?This is what I would use to query 1...
View ArticleHelp in Total sum query
Hello, How I can sum(code1). Every code1 has a group and every group's total (total_per) should be 100. I want to add the comments column in the result as well. Thanks.create table #Cumulate (code...
View ArticleQuery Performance
Hi ,hereunder an execution plan for a query that takes hours to complete, as the execution plan the nested loop consume most of the time , is there any way to enhance this
View ArticleSample cursor code
In the sample cursor code, I have SELECT statement that I don't understand.HEre is the code.SET NOCOUNT ON; DECLARE @Result TABLE ( custid INT, ordermonth DATETIME, qty INT, runqty INT, PRIMARY...
View Articlefinding minimum and maximum
I have written this query to find out minimum and maximum value but couldn't get the date from period column according to minimum value.DECLARE @sqlCommand varchar(1000) --DECLARE @columnList...
View Articleadd a column to an existing tables if they contains column with name [name]
Hi all, I want to add a column to all tables in the database that contains the column with name "text"i tried to useALTERTABLE table_nameADD mydate datetimewhere table_namein(SELECT c.nameAS ColName,...
View ArticleBatch and GO?
i have seen so many SQL scripts using the GO operator to provide database context but I failed to understand why. what difference does it make if I don’t use GO statement in this scenario? USE...
View ArticleThe mail could not be sent to the recipients because of the mail server failure.
Hi, I am configured Database Mail,But i am getting below error while i am sending Test mail.MessageThe mail could not be sent to the recipients because of the mail server failure. (Sending Mail using...
View ArticleCheck what records are missing in child tables when compared to Primary tables
I have a person table(200 records with 200Persons),Column Person Id (PK),FN, LN,USERNAME and there are 13 tables which are referenced by Person id ex: Attachement table has a column UpdatedPersonidex:...
View Articlewhat is the easiest way to drop all objects of a schema?
what is the easiest way to drop all objects of a schema?I mean - programtically - without knowing in advance what the objects are
View ArticleDB Access Speed improvement
When try accessing and acquiring huge data and speed is too slow, what should I consider in order to improve this poor performance.There can be a server side improvement and client sidefor example...
View ArticleMS Access reading SQL. Issue date format
Hi guys, I am struggling with Access reading data from SQL. Of course I am talking about date format. In SQL I have got a column setdate datetime(2), in Access I got a mask with two forms, both Format...
View Article