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

How to load data to several tables while passing id numbers, which was...

Environment: SQL server 2005 and Win 7. Tools: MS. SQL Management Studio 2008 R2. Data: Flat file source contains large data but here let say nine records in a csv format. The attributes are [SSN],...

View Article


How to insert multiple rows to several tables while capturing a generated ID...

Environment: SQL server 2005 and Win 7 Tools: MS. SQL Management Studio 2008 R2 Problem: There are several DB objects in the database: @Table_source, @Table_people, @Table_ssn, and stored procedure...

View Article


Pivot Query help needed

Hi all,select Group_Age,Group_Class, sum(No_of_OD_Claims)No_of_OD_Claims, sum(No_of_tp_Claims)No_of_tp_Claims from dbo.A_Summary_OD_and_TP_1213 group by Group_Age,Group_Class order by cast(Group_Age as...

View Article

Can you set a single FILEGROUP to READONLY without getting exclusive access...

I'm in the process of building a partitioned table with a sliding-window partition.  I have several years of historical static image data that will be moved to individual filegroups created to hold...

View Article

Please list some tips to write good sql queries

Please list some tips to write good sql queries .. example : sql indentation, ..<o:p></o:p>

View Article


delete rows with a condition from all tables

I am having 100 plus tables with millions of rows and having ID column and other columns too in 1 database on dev server ,i will have to delete all rows from all tables except id 3000( which i will...

View Article

SQL Loop to Exclude Records

I need help with automating a process in SQL Server.  I want to use a loop to exclude certain records.      Calculate the impact  of each record to the “Average Selling Price” in the attached excel...

View Article

Query needed

declare @temp table(patnum int, rownumber int) insert into @temp (patnum,rownumber) select 123,null union select 123,null union select 123, null union select 456, null union select 456 , null union...

View Article


When to use Count and when to use Sum

How do you know when you should use COUNT and when to use SUM functions?

View Article


Workload

Hi,Can anyone tel me how to create workload? My requirement is I need to analyze all the queries running against a DB. What exactly needs to be in a workload. I could not see this in any forums. Please...

View Article

SQL Server 2008 - Stored Procedure Question

HiJust a quick question on Stored Procedures in SQL Server 2008I have written a basic stored procedure to write records to a temporary tableWhen I execute it from the SQL Server Management Studio it...

View Article

how to create tables dynamically using while loop and insert the records from...

Hi, i need how to create tables dynamically using while loop.this below query is created for one table but i need dynamically. declare @columns nvarchar(max) set @columns='['+'MemberID'+'] Mem_ID,'+...

View Article

Dynamic update statement in INSTEAD OF UPDATE trigger

It is possible to use dynamic base table update statement in INSTEAD OF UPDATE trigger. I have a wide table (more then 100 columns) and so I don't know, how to forward updates to only really updated...

View Article


Find columns in select query

Hello,I don't know if this is the right place to ask this question but I thought it would be the best bet.I want to be able to detect the column names in any given select queries, I though using a...

View Article

Image may be NSFW.
Clik here to view.

how to make a join in xml

I have below xml  DECLARE @t TABLE (  ID INT IDENTITY,  Data XML  )  INSERT INTO @t (Data)  SELECT '<ROOT><employeeinfo>  <employee><employeeid>1</employeeid>...

View Article


Print Hex value as string without 0x

select CONVERT(varbinary(max), 729231826, 2), Substring(CONVERT(varbinary(max), 729231826, 2), 3, 8)I am using above convert statement to convert my number (729231826) to hex value  so i get result...

View Article

SQL browser

A question about SQL browser, we have a cluster with 2 nodes. On node1 it installed two instances, one production, one QA. The same as Node2. The browser recently keeps stops, causing front end...

View Article


Xml to Table Conversion-Parse Duplicates

Hi ,I have any xml like the following : DECLARE @A XML=...

View Article

Calculate Columns from different tables loading into single table SQL

Hello Guru'sI am facing an issue with calculated columns. I am having few calculated columns and I want that to insert into a table or create a SQL COMMAND. for ex: column 1 must  load query1 output...

View Article

How to create a list of Item Locations from a list of Locations

I have a table something like this:Location Item Count --------- ---------- ------ 19 050-05 1 20 050-05 1 3 050-19 72 12 050-19 72 77 050-19 56 90 050-19 24 7 050-21 96 13 050-21 64 24 050-21 96 9...

View Article
Browsing all 23857 articles
Browse latest View live


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