Crosstab Query
Hi, I am trying to replicate an access crosstab query I have use PIVOT but this is not working as this requires an aggregate function.However , I would like output in this...
View ArticleStoring 6 millions values in SQL server columns
Hi,How many values (size) I can store in single SQL server column.My Scenario,Column1 Column2 Column3 1 ABC 1,2,3,........(6 millions values) 2 CDE 1,2,3,.......(6...
View ArticleApril's T-SQL Gurus Announced!!
The results for April's TechNet Guru competition have been posted!http://blogs.technet.com/b/wikininjas/archive/2014/05/17/the-microsoft-technet-guru-awards-april-2014.aspxCongratulations to all our...
View Articlesyntax error
Hi Experts,I get an error on the syntax when i want to create a new table from a join. Here the query:USE GeniqOrbis CREATE TABLE ZORGREG AS SELECT [PSY_PSHOE].[PSYIN_IDEN] ,[PSY_PSHOE].[TYD_VAN]...
View ArticleCoding puzzle
Hi all, I think this should be simple but I'm having trouble - can't get my head round the various options.Basically I need a list of which Reports are being run - the last run date and the user who...
View Articlet-sql 2008 r2 explain select
In existing t-sql 2008 r2, there is the following sql that I am trying to understand so that I can modify it. The field that is called tMask is definitely as an integer. The values stored in this field...
View ArticleUpdate Query With Join
I am getting error of multi-part identifier could not be bound, but can not remove the error from my query? SQL Server 2008Update fafa set fafa.uid = '100', fafa.logindate = GetDate() From...
View ArticleTSQL Previous vs Current Record Flag
Hi All,I have two tablesTable 1 SEnrolmentID ActiveFlag FromDate ToDate 1111 N 20/05/2014 21/05/2014 1111 N 21/05/2014 22/05/2014 1111 Y 22/05/2014 31/12/9998Table 2 SEnrolmentID StatusKey ActiveFlag...
View ArticleHow to prevent DDL from creating uncommitable transaction
I am looking for a way to prevent execution of bad DDL from making an entire transaction uncommitable. The simplest use case I can provide is:DECLARE @SQL NVARCHAR(MAX);BEGIN TRANSACTIONPrint 'In...
View Articleinsert into table
hii have result ser like thisID member program date1 23 4 05/10/20101 23 4 05/12/20122 23 4...
View ArticleError Running Update on Table with No PK
This table has no PK and unfortunately I can not add one :( -- this is the query I need to run, but it constantly throws the below error. Query works fine if I run on the same server, but...
View ArticleQuery help on some conditions
Hello All please let me know how can i achieve thisdrop table #mytab create table #mytab (acctNo NUMERIC , phoneType varchar(10), PhoneNo NUMERIC ) INsert into #mytab VALUES (123456789, 'HOME',...
View Article**Free** E-Book!
http://www.red-gate.com/community/books/sql-server-execution-plans-ed-2?utm_source=ssc&utm_medium=publink&utm_campaign=books&utm_content=executionplans_ebook&utm_term=executionplansFree...
View Articlemerge two columns data to one column
Hi Team,I am trying to merge data from two column into one column as shown below:Any suggestions on how to achieve this?Thanks,Eshwar.Please don't forget to Marked as Answer if my post solved your...
View ArticleTable with adds and subtracts, trying to get the balance
I have a table that lists adds and subtracts from an inventory itemI am trying to figure out how to get the balance from all the rows.i.e.row 1 Add 20 (balance is now 20)row 2 Subtract 10 (balance is...
View ArticleError while taking back up.
Before few month box of SQL has been crashed. We have almost database back with some tools and running application smoothly on it. But when i try to take backup of database at that time it gives error...
View ArticleError While enahling CDC(Change data capture) on Table.
I am enabling Change data capture (CDC) on SQL server 2012 Enterprise edition(11.0.2100.60). I am able to enable it on Database level with below SQL, but failed to enable on Table level.Use...
View ArticleIs snapshot isolation correct in following situation.
Hi,i am using two databases. d1 and d2from one data database (d1) i get data and transfers it to (d2).the transfering sp (uspTransfer) is in (d1) which is called by an other sp(startuspTrn) from...
View ArticleHelp with schema to support tables where records exists for single entities...
Hopefully I'm not using incorrect terms, so let me explain to clarify what I'm trying to do.Basically, I'm trying to create a database that will store information on businesses. So something...
View ArticleHow to get the Parameters of a Parameterized Query from dm_exec_sql_text
Hi,When I am running the DMV to run the previously run Queries in Sql AzureSELECTsqltext.TEXTFROMsys.dm_exec_query_statsAS CPCROSSAPPLYsys.dm_exec_sql_text(sql_handle)ASsqltextI am getting the Text as...
View Article