Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

pivoting multiple coulmn values into multiple columns dynamically

Hi,i have found some topics related to 'pivot' in this forum. but my situation is a lit bit different.I have a table like the belowcreatetable#temp(id int,code...

View Article


2 Primary Keys

I have a table with a number of columns and one of them is an identity column which is also a primary key and I have another column which is not an identity but I do need it to be unique by itself,...

View Article


accessing record from table and storing it as variable

My table consists of fields like thisS.N. ------Customer_ID---------- Loan_taken_on(Date) ----------Payment_made_in(date)=============================================================1 -------- 5001...

View Article

same where condition for union all query

Hi, Here i am going to fetch same column name from 3diff tables with same where condition. Is any other way to write the below code.set @datas =(select ACCOUNT,FACILITY,VERSION,TIMEID,SIGNEDDATA from...

View Article

T-SQL: Manual Backup of Multiple Databases

I am looking to change the way I do manual backups of multiple databases on the same instance of SQL Server 2008 R2.Currently I have T-SQL scripts for each database that look like this:BACKUP DATABASE...

View Article


how to give where condition in following query

Hi,I am going to fetch the data in two facilities like "FA_2003", "FA_2005". First i am fetching the details in 3tabales then filter by using the account and timeid. I am 1st insert facility and...

View Article

Index on multiple columns

Hi Experts,Need your advise to create indexes in the following scenario.For example, we have a table OrderDetail with the following structureCREATE TABLE [dbo].[OrderDetail](    [SalesOrderID] [int]...

View Article

Multiple indexes on a table with various combinations

Hi Experts,This post is similar to my previous one on indexing. am just trying to understand proper indexing strategy.Assuming that i have to use following queries frequently.select Col1, Col2, Col3...

View Article


how to avoid or replace a sub query from Exists statement.

Hello all, I have a query regarding sql query.     DB 1 ----- Table A                                 Table B -------- ID   Code   HeaderID            ID    --     ---       --------...

View Article


DeDup picking lower value of second column

I am so sorry to bother you all with this but I can not seem to get this perfect directly in SQL. I have a table like this with about 6 million records in it:NonUniqueID | ValueICareAbout1 |...

View Article

Optimizing stored procedure

Hi,This is my stored procedure, Is there any way to avoid temptable to improve performanceCREATE procedure [dbo].[sp_GetMALReportDetails](@CategoryID INT = null, @StatusID INT = null, @UserTypeId int =...

View Article

How use "Description" as a column name

hello I want use "Description property" as a column name.likeSelect * as [their Description property] from myTabI I Find this code for getting "Description property"  of each column select st.name...

View Article

SQL temp database full

Ok here is the issue, I create a query that did a massive sort, so the hard disk that have that database become full, now What to do:1. Restart the service and wait for the original database where the...

View Article


how to compare two varchar columns (join) by elimination a part of data please

-- My first Datacreate table #myfirst (id int,city varchar(20))insert into #myfirst values (500,'Newyork')insert into #myfirst values (100,'Ediosn')insert into #myfirst values (200,'Atlanta')insert...

View Article

Problem with rollback

Hello,I have this queryDECLARE @TransactionName varchar(20) = 'inlinefunctionTransaction'; begin tran @TransactionName select * from jsp('S1','P1'); ROLLBACK TRAN @TransactionName; gobut when executing...

View Article


Stack dump: SQL Server keeps crushing

My SQL Server keeps crushing with a stack dump error saying: (in the management studio error log):spid197    External dump process return code 0x20000001. External Dump process returned no...

View Article

Problem with completely nested query

Hi,I have this completely nested query:SELECT S.sname from S where   S# in (select S# from SPJ where   P# in (select P# from P where P.pname = 'Bolt')   and           J# in (select J# from J where...

View Article


Image may be NSFW.
Clik here to view.

Database Server - SQL Access: Cannot connect from code but from SSMS

Hi, I am using following connection string in my asp.net web.config: [Less than symbol] add name="FMMConnectionString" connectionString="Data Source=xxxxxxxxx,1234;Initial Catalog=Test1Db;User...

View Article

EXECUTE permission denied for local system user

I have a NetIQ alert that runs a stored procedure that generates an execute permission denied error each time it runs. The NetIQ agent is running as the local system user. As I understand it, the local...

View Article

Create a Parameterized Query from a Data Table (VB.NET)

Hello Everyone...I am making a DBMS for a library. For that I have 3 tables:Books_Main (BookID, Title, AuthorID, PublisherID,  NumOfPages, Language, YearPublished, Version, ISBN, Location)Books_Authors...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>