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

How to find a hierarchy of employees, 3 levels deep, using JOINS

Hello,I would like to generate a table like this:Level     PersonName         empid        ManagerID           Code             ManagerName              1            Big Boss                  1...

View Article


Image may be NSFW.
Clik here to view.

How To Make A WPF Datagrid Act Like A Spreadsheet

Greetings,I posted an earlier similar question regarding this issue without finding a solution, but have since found a way to make a WPF DataGrid act like a spreadsheet.  Below you will find the user...

View Article


Image may be NSFW.
Clik here to view.

How to find the total number of pair under particular parent according to...

My tbltestingtree structure is as follow:     ID                      ParentID              IsLeft     IsRight             joingdate     Ramesh123       NULL                    NULL       NULL...

View Article

SQL Server 2012 - xp_cmdshell - second call fails.

I have just upgraded a system from 2008 R2 to 2012 SP1.I have an issue with a scheduled SP that fails 'randomly' whilst processing/emailing a series of files created by a previous SP.The SP gets a...

View Article

calcaulate percentage for each column by its own total

i got data like this :A B C (35%)54 (60%)9 (37%) 63 (25%)39 (26%)4 (25%) 43 (24%)37 (13%)2 (23%) 39 (14%)22 0 (13%) 22 0 0 0 the base data at start are only columns A and B.what i want to do is 1) to...

View Article


Index Size Limit

Hi ,What is the reason behind size limit of Index.Why SQL Server fix that into 900 B ?Samith C Valsalan There is no Wrong time to do Right thing :) Please mark it as an answer/helpful if you find it as...

View Article

Determining Public Access to xp_regread and xp_instance_regread

I am trying to write a query to determine if public role has access to both of these.  I need this to satisfy auditing requirements.  If anybody knows how to write the t-sql to turn these on, I should...

View Article

Unexplained poor table query performance

Hi All I am really open to any advice as I have hit a kind of brick wall,  a developer came to me asking about y a procedure was performing so slowly in beta as opposed to dev and after looking at...

View Article


linked server check availability check

Hi Forum,I have a problem with checking the availability of linked Servers before code execution.I created a procedure using sp_testlinkedserver which works fine. I use an OUT parameter to return the...

View Article


Which sql statement is more efficient

There are two sql statement which do the same thing,I wonder which is more efficient and why?The two sql statement are as below:1.   select Sessionid from tableTest1   where sessionid in   (...

View Article

Image may be NSFW.
Clik here to view.

Indian Numbering (lakh, crore, ...) at this Forum?

The language of this forum is USA English. I am opposed to using Indian numbers. Some forum members disagree with me. What's your opinion? Thanks.Kalman Toth Database & OLAP Architect IPAD SELECT...

View Article

ALTER TABLE SWITCH PARTITION when exist partitioned and not partitioned indexes

Hello,I need to switch partition for a table that has another non partitioned index, so partition 1 exists two times.Is there any way to do that?Thank you,ManoGeozah

View Article

TRY_CONVERT for sql server 2005

hi, experts, I found a function from sql server 2012. try_convertSELECT CASE WHEN TRY_CONVERT(float, 'test') IS NULL THEN 'Cast failed' ELSE 'Cast succeeded' END AS Result;can solve what I need....

View Article


How to create list of a View's column names and source

Using SQL 2005, 2008, and 2012How to create list of a View's column names and source. For the following example would like to @Print something like the following.  Does anyone already have some code to...

View Article

Problem on DATEDIFF statement

I'm trying to use a DATEDIFF statement so I only see data from the last 7 days How would I write that if I don't have a time stamp in a table to reference? If I could reference something I know I could...

View Article


Delete a variable number of records

Can I do something like this?DECLARE @del AS INT SET @del = 10 DELETE TOP(@del) FROM TABLE

View Article

Holiday Calendar

Hello and happy new year! I wrote a stored proc that basically aggregates some data based on how many Monday's, Tuesday's, Wednesday's etc in a current month (date range parameters). The proc works...

View Article


Use of function

I have a table with this records: linknumber history 110 46,57,89 220 50 330 22 440 10,12 I want to have this result: rownumber linknumber history 1 110 46 2 110 57 3 110 89 4 220 50 5 330 22 6 440 10...

View Article

I need Data Migration design.

I have 2 databases The databases are called   db1 and db2 on sqlserver .db2 is an extension of db1 so it has many more tables and design changes.I need to migrate data from database db1 the earlier...

View Article

Work around for INSERTEXEC Nesting?

I need to access the results of a stored procedure in a temp table which would normally be done using INSERT/EXEC. My problem is that the stored procedure already uses INSERT/EXEC and nesting of this...

View Article
Browsing all 23857 articles
Browse latest View live


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