RDP into server - queries run slow
Hello,Environment:I have a remote server with SQL server 2014 instance on it. There is nothing else running on the SQL Server box(dedicated SQL box). There is only one instance of SQL 2014 on the...
View ArticleUnable to recognize table nale or filed names
Hi all,I have created a table name "tblPopulation" with fields 'Country', 'State' etc....When i query it with table name as tblpopulation with fields 'country', 'state' then i get error as invalid...
View ArticleDuplicate record count
I have duplicate records in table.I need to count duplicate records based upon Account number and count will be stored in a variable.i need to check whether count > 0 or not in stored procedure.I...
View ArticleRetrieving all error messages generated by a command
Hello All,Some T-SQL commands can fail with multiple errors. For example, if you try to disable a primary key constraint using ALTER TABLE t1 NOCHECK CONSTRAINT PK, you will get messages...
View ArticleEnquiry on retrieving data from database
Hi, I have a drop down menu for transmission. Inside the drop down menu, there are 1.Any 2.Auto 3.Manual optionsNow I want to retrieve from my database, if the client select '1.Any' option. Meaning the...
View ArticleSQL Help
I have a Contract table with a CoverageCode column. I what pull 5 records for each CoverageCode. Currently I am doing this:SELECT TOP 5 * FROM Contract WHERE CoverageCode = 1UNIONSELECT TOP 5 * FROM...
View Articlehow to call dynamic query stored procedure in select statement
Hello, i have created a stored procedure with dynamic query and using [b]sp_executesql[/b] . stored procedure is work fine. now i want to call stored procedure in select statement because stored...
View ArticleHow to join INFORMATION_SCHEMA.COLUMNS, COLUMNS_UPDATED ( ), inserted and...
Hi :) On google, i found a script for Update Trigger without using a Cursor (). Line 32 to 74http://beyondrelational.com/modules/2/blogs/71/posts/11988/how-to-find-the-right-columns-updated.aspxAnd...
View ArticleHow to keep Canadian and US customers database separate in their country
We have a need to keep MS SQL server data of users in their country, USA and Canada. We have servers in both country. We have a single web application that need to manage data for both and it has to be...
View ArticleBulk Insert
Hello, I need to load the following data into a SQL table. This is how the vendor is able to provide it to us.[code]CRCorp Daily Report,,,,,,,,,,,,Facility,Location,Purchase Order #,Vendor,Inventory...
View Articleneed repetition of a table when joined with another table
table1id value1 112 123 134 14table2id1 value11 212 221 312 32in need output as followsid value id1 value11 11 1 212 12 2 22 3 13 null null4 14 null null1 11 1 312 12 2 32 3 13 null null4 14 null...
View ArticleHI...Sample INSERT statement script needed to insert 500 million rows into...
Hi, I am doing a performance testing for In-memory option is sql server 2014. As a part I want to insert 500 million rows of records into a in-memory enabled test table I have created.I need a sample...
View ArticleConverting Hour and Minute to Decimal
Hello,I am having some issues converting time to decimal from one of my column which display it as2014-07- 08:16:31.000 (datetimecreated)A solution to make this work would be greatly appreciated.Thank...
View ArticleRun same script for multiple clients
Hi, kind of new to sql so help would be much appreciated. I have a script that needs to be run for 50 different @ClientID. I dont want to run this script individually for each clientid. Would 'SET...
View ArticleAdding unique int key using max
I am trying to add multiple records to my table (insert/select).[code] INSERT INTO Users ( User_id , Name ) SELECT ( SELECT MAX(User_id) + 1 FROM Users ) , Name[/code]But I get the error:Violation of...
View ArticleFinally! T-SQL Reference for SQL 2014 available for download!
With a mere delay of four month since the release, it is now possible to download the T-SQL Reference for SQL 2014 for your local copy of Books Online. Due to some reorganisations of the reference...
View ArticleGet next primary key without identity
I have a table to store int primary keys. Where the value nextID is the value to use.I need to get the value and update it (nextID + 1) before the next person gets it.I thought using tran would work...
View ArticleDuplicate key issue when Insert/Select
I have an issue where I am getting an error on an unique index.I know why I am getting the error but not sure how to get around it.The query does a check on whether a unique value exists in the...
View ArticleHow to send a mail alert on field value change in Table with both value old...
Dear All,I have a Table "Customer" which contain a Field "CreditLimit",Now I want a Mail alert on change of this filed with both value old credit limit value and New credit limit value.Is its possible...
View ArticleOperator used tempdb to spill data during execution with spill level 1
Hi,i have 2 tables created in SQL Server 2014 viz., Staging table & yearweek. Year week gives the Yearweek, Yr & Week running numbers starting from year 2011 (created using Tally function). I...
View Article