Learn more about SQL Server tools


SQL Server Question and Answers

Ask a SQL Server Question

Search All Questions:
SQL Server Questions And Answers
<< Previous Page        Next Page >>

problem with dynamic sql using a local variable
I have been struggling with dynamic sql for a few days, and there is one problem I cannot resolve. -- Insert User into tblUsersprint 'Insert USER ... '+ @loginname_noqoutes + ' into tblUsers 'set @sqlstr2 = 'USE ['+@databasename+'_TEST] INSERT INTO tblUS

asked 10/10/2015 7:15:48 AM
by David Scott
2 answers

does update statistics or reindexing better for fragment percentage > 30% - SQL Server 2008 R2
Attached is the part of our one sql database index fragmentation report. I've copied only the fragment percentage > 30%. As I can see there are lots of indexes > 30% and this is not very good? Is this right? Also I've been advised just to run updat

asked 10/7/2015 7:41:25 PM
by sar123
0 answers

Extract all table names and their row count from SQL linked Server
I am using the following select statement to get the row count from SQL linked server table. SELECT Count(*) FROM OPENQUERY (CMSPROD, 'Select * From MHDLIB.MHSERV0P') MHDLIB is the library name in IBM DB2 database. The above query gives me only the row

asked 10/7/2015 2:20:38 AM
by helal
0 answers

chancy delete filestream of driver f:\Blobstore
hi I have a database in SharePoint 2013 (WSS_Content_81_Lib) blobstore had enabled the sadly filestream.hdr deleted files. But mdf and ldf files've got. How can I attach the database up(WSS_Content_81_Lib). Thank you very much.

asked 10/6/2015 10:34:53 AM
by hossein
0 answers

SQL server not releasing memory
Hi,I am using SQL 2008R2 (prod server). Total server memory is 20 gb. I assigned for sql 14 GB and setting max and min limit in SQL memory settings. Currently the sql utilizes total memory( no active process) it did not release the memory. When i am tryin

asked 10/6/2015 8:14:34 AM
by Sree
0 answers

Hi i want to create a a script in which i can get the below information Database Size settings   Internal free size in database  Below is the query i created Can you please help me as im struggling with joins SELECT @@servername serverHostn

asked 10/2/2015 7:54:52 AM
by anshu
0 answers

SQL Server 2014 Std Edition - Licence
Hi All I have few questions regarding 'SQLSvrStdCore 2014 SNGL MVL 2Lic CoreLic'   SQLSvrStdCore 2014 SNGL MVL 2Lic CoreLic    1. is Per Core or Server/Cal 2. how many core will this support 3. What is meaning of SNGL=?, MVL=? an

asked 10/2/2015 7:03:19 AM
by Nikhil P Desai
1 answers

SQL Server 2012 Std Edition - Product Key
Hi All, I have few doubt regarding SQL Server product key   Is there a script or any method 1 to check the product key in installed SQL Server 2012 Standard Edition (64-bit) SP2. 2. Expiry date of Product Key   Thanks in advance 

asked 10/2/2015 7:00:21 AM
by Nikhil P Desai
0 answers

Create Weeks Calendar from Date in SQL 2012
I need to create a week calendar from date in SQL 2012. Week date starts with Sunday regardless if first Sunday or last Sunday overlaps with previous or next month. For example, the first week in Sep 2015 starts on Sunday 8/30/2015 and ends in 9/5/2015. T

asked 9/30/2015 3:33:09 PM
by Helal Mobasher
0 answers

Looping in Trigger
--There are 3 tables: TableA, TableB and TableC.  CREATE TABLE TableA (Id INT, Value VARCHAR(50)); CREATE TABLE TableB (Id INT, Value VARCHAR(50)); CREATE TABLE TableC (Id INT, Value VARCHAR(50)); --All tables are having triggers: TableA with tri

asked 9/30/2015 8:47:28 AM
by Lokesh Shukla
1 answers

Error in ETL Package execution
Hi,       ETL Packages are getting failed sometimes(Package Execution Error). Eventhough executing ETL Package again from start, getting the same Error. But after Restarting Sql Service in BI Server, it is working fine. Whether it is the i

asked 9/25/2015 6:42:45 AM
by CgcsPvtLtd
0 answers

Give dynamic Table names while running from one table
Hi All, I am stuck at a point as I want to create a store procedure In which I will pass the tablename and the another table will be created with the same table name and after that _Format. eg: If I have abc table then the output of table will be abc_Fo

asked 9/22/2015 4:34:43 PM
by Satishchandra Vishwakarma
0 answers

Why is it taking longer to create an index after column size increases?
Our vendor changed column widths on almost every column in the entire database.  The database is around 7TB, 9000+ tables. We are trying to create an index on a table that has 5.5billion rows. Before the vendor's upgrade we could create the index in

asked 9/16/2015 2:44:18 PM
by Daniel
0 answers

Need backup status success\failure columns for Full DB status and differential DB status
SELECT @@Servername AS ServerName,d.name AS 'DATABASE_Name', CONVERT(VARCHAR(10), DATABASEPROPERTYEX(name, 'status')) AS [Status], MAX(CASE WHEN bu.Type = 'D' THEN bu.LastBackupDate END) AS 'Full DB Backup Status', MAX(CASE WHEN bu.Type = 'I' THEN bu.L

asked 9/15/2015 7:41:03 AM
by vindhya
0 answers

Show the subreport Page header in the main report
HI, is it possible to with new ssrs versions to display the subreport header in the main report? I would appreciate any help.   Thanks, Christine

asked 9/11/2015 3:39:25 PM
by Christine
0 answers

Master Data Services Excel Add-In Delete Leaf Member Error
After instructing users to ONLY delete members using the delete button on their Excel Add-In Ribbon, almost immediately someone selected a leaf member, right clicked with their mouse, and selected delete from the drop down list.  Subsequent attempts

asked 9/11/2015 8:57:52 AM
by Lance
0 answers

Max Degree of parallelism
What is Max Degree of parallelism...? What is the use of it, How do use it, What is the main reason behind configuring the MAXDOC      

asked 9/10/2015 7:55:39 AM
by Ramchinni
1 answers

image retrive queries
I want to know the query of image insert and retrive.   single image and bulk image insert and rerive with out front end coding   only sql server queries....  

asked 9/8/2015 4:23:52 AM
by ravichandran
0 answers

Memory Limit for a database
  SQL Server 2008 R2, would like to limit the buffer cache for a particular database. Can we use resource governor UDF classifier function to acheive this?

asked 9/7/2015 12:51:18 PM
by Akhilesh Narayanan
0 answers

Restoring two separate databases having same tables from one another's backup in SQL server 2008
I have two different databases named (i) admindatabase (ii) resultdatabase. These databases have exactly the same table. admindatabase is the main database and is used by the admin staff of a school, whereas resultdatabase is used by the teaching staff o

asked 9/7/2015 4:40:06 AM
by Sohail Akram
0 answers

Sponsor Information



Get Free SQL Tips










BI Professionals


Q and A

Today's Tip







Tip Categories

Search By TipID



First Timer?


Free T-shirt



User Groups

Author of the Year

More Info








Copyright (c) 2006-2015 Edgewood Solutions, LLC All rights reserved
Some names and products listed are the registered trademarks of their respective owners.