Selecting values dependant on criteria
Hi there, DECLARE@tmp TABLE(NameCHAR(30),balancechar(6), tpk INT,TypeVARCHAR(10),DescrCHAR(40),FieldCHAR(50))INSERT@tmp SELECT 'Leigh', 43.20, 12345 ,'272' , 'Sales', ''INSERT@tmp SELECT...
View Articlepartitioning the tables using the same partition function
hello,i am tryinng to partition about 20 tables in the same database using one single partition function and one single partition scheme ex: CREATE PARTITION FUNCTION partfunc (int) AS RANGE Left For...
View ArticleList all columns having only nulls from all tables in a database.
I want to select columns from all tables having only null values. Each table has 60+ columns and i have 100+ tables in database. Requesting a script to list all tables at a time and their columns...
View ArticleTransactional log usage for ALTER tables
Hello All,I have a requirement where there is a table with ~5 million rows and the table is replicated on read server. I will need to alter the table to add two new bit fields defaulting to zero. Which...
View ArticleHow to sort data based on two date columns among which one has to be grouped?
I have the following set of data. select * from STATEMENT_HISTORY(nolock) order by stmt_dte descstmt_key stmt_dte stmt_start_dte 12 2013-10-13 00:00:00.000 2013-07-10 00:00:00.000 11 2013-10-12...
View ArticlePower View Maps - Getting data from the maps
I created a Power View map of my accounts that includes the zip codes. It gives me a great visualization on a map.Is there a way to grab the data behind the map for a certain area of the map? Here...
View ArticleWhy the more powerful server writes data slower than the less powerful server ?
We are using SQL Server 2012. The same database myDB (Simple Recovery mode, Autogrowth by 1000 MB on the data, and by 100 MB on the Log) exists in 2 different servers, server A and B. Server A...
View ArticleGenerate Email
Hi I want to send an Email using Sqlserver . It works on the desktop clients and I can see the image on my outlook 2010,but in the cell phone,the image is displaying as an "Attachment file". How to...
View ArticleSorting Addresses from CSVs
Hi allI have a CSV file which has it's information out of sync with it's column headers - the post code is in column Address1. Please see attachment of a sample record.Even though this is obviously...
View ArticleNeed to Split a Date Column into 2 solumn as Start Date and End Date
I need help over this thing. I am working on a table which looks likeDate Dateofyear2014-01-0112014-01-0222014-01-0332014-01-0442014-01-055......2014-12-31365Now i need to Run a query on this table to...
View ArticlePuzzling situation - same code - different results
Hi everybody,I am having a very strange situation.I have a complex class written by my colleague in C# application. I have another class that has a method calling an instance of that class and a...
View ArticleLoop While Select Statement
Can someone tell me what I am doing wrong. When I run the query I get the '01/14/2014' date over and over again. I was looking to get every Friday's date for 2013. Is there an easier way to do...
View ArticleFETCHING DATA FROM IN BETWEEN DATAS
hi i want select the data from facplan table where time id is start from 100007. now i want to sum all the data in 100001 to 1000007. how can i do it?SELECT SUM(SIGNEDDATA) FROM FACPLANWHERE TIMEID...
View ArticleCompare int to nvarchar ?
Have a need to compare an nvarchar variable to an int value in a table. I thought I would have to cast nvarchar to int, but the direct compare seems to work. Is this some sort of default conversion...
View ArticleComplicated Join
I would like to select a list of customers and add a column to the select to show if the customer is within terms of paying up their due invoices. How would I do it? Right now this is what I haveSELECT...
View ArticleUpdate an entry of Linked Server
Is there a way to update SRV_NAME of a Linked Server using an update query?
View ArticleAppend all matching records from one table to Another
I have 2 tables, which are listed below.-tblMAIN -tblAdditionstblMain contains all the data and tblAdditions contains unique types. These tables are joined together by the common field "LinkID". I'll...
View ArticleJoin the SQL Server Msdb.dbo.SysJobSteps to the SSIS Package table...
I have the following query which returns jobs and jobsteps - for those items which have SSIS Packages attached, I would like to include a link to the results of this query below - to the actual SSIS...
View ArticleHow to reset IDENTITY fields
Dear all,I have a big database structure where I need to reset in different tables the Entity column value number to start from 0.I usually do this by using a TRUNCATE TABLE but as my tables as many...
View ArticleMSSQL 2008 R2 - 32bit, TSQL backup with compression, error: There is...
Hello,I would like to ask you about advice.We have MSSQL 2008 R2, 32 bit. Memory is 4GB, split into 2GB for Windows and 2GB for applications. Database has recovery model simple because we have...
View Article