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

Complex SQL to see roles from groups?

Hi, First post.... I'm trying to map roles to LDAP group membership and hoped I could get some help with how to analyse this please? A role consists of between 1 and x groups from a set of x groups. A...

View Article


SQL mail triggers

I am using SQL 2008 R2.  I would like to setup a trigger to send an email after an email is added to a table.  The table name would be 'iPad' and the email column is 'text_box_3'.Any help would be very...

View Article


Cannot Update Table when Data exist??

Hi All,I have encountered a wired scenario in recent times.I am using SQL Server 2008.In a database, I have been using a stored procedure to insert/update a table ,, stored procedure has several temp...

View Article

How to Join 2 tables if datetime diff is within range?

Hi, problem figuring out how to join tables if the datediff ? is within range.  There are 3 tables  a main table then 2 sub tables, these are measurements with a date/time value.  Im trying to take the...

View Article

How can I hide null records for selected value?

I have table with the following data:Product Cost Orange Null Apple 2 Carrot 2 Banana Null Banana 3I would like to display all records except for the Banana with the null value. The result should...

View Article


Using CASE WHEN to check multiple rows of a table

So I have a table called MATERIAL with a field named MATERIAL_SHIPPED. It will either have a 1 or 0 value making it as shipped or not.There may be multiple materials for each PROJECT record. I want to...

View Article

How to put grouped results all on one line.

I amt trying to get Principal, Interest, Principal YTD, Interest YTD from a transaction table to get them all on one line, but I can't seem to get it. I have a script here that can run without...

View Article

user login via web services

I am new to the web services and  i want to get records from database SQL Server, against SELECT * from Detailed WHERE Email ='" + Email + "' and Password='" + Password + "' "Here is my code but when i...

View Article


How to get the pivot result for these 3 tables ?

....

View Article


SProc executing twice - or getting Msg 233, Level 20 transport-level error...

I am connected the local SQL Server. In a Query Window I try the following.  At first It was executing the sproce twice. I closed the query window (several times) and reopened a new one. Stripped out...

View Article

Sql query to retrieve records in parent sibling relationship in a table

I need help to write this Sql query on a table where it has the primary_id, parent_id, and sibling_id. A new row can be created with or without the parent_id and sibling_id. However most of the new...

View Article

Not Exists is taking very long time!

Hi Team,Not exists is taking very long time. ETL.Table1 has 50k records for recordtype = 1 and 49466 for recordtype =2. The difference is 534 for returning these records the query is taking close...

View Article

Image may be NSFW.
Clik here to view.

reliability of using global temp table in shared stored procedures

Hello - In our reporting environment we have some reports that require the same basic information as a starting point so we have shared stored procedures that fulfill this need.  For the case in...

View Article


DB stores in cp1250 I want to utf-8 on ASP pages

Hi,I read many articles about using DB in different encoding than www pages are. But still don't have a solution. My MS SQL database store data in Czech Collation, codepage 1250. And my website has...

View Article

Sql filter Get the count of invoice details based on specific criteria

Glasses DatabaseGucci PremierGucci High Quality lensesGucci Pink Gucci MaroonGucci BlueRimless RedRimless OrangeRimless GreenRimless BlueRimless PurpleVisual Full RimVisual Half RimVisual RimlessVisual...

View Article


Balance Sheet Retained Earnings Calculation

Hello,I'm trying to create a complex calculation for a metric on a Balance Sheet called Retained Earnings (pretty sure satan himself wrote this calculation).  I've been working on this for over a week...

View Article

Avoid sub select to improve the performance

Hi Team,Share you suggestions.    declare @Startdate DATETIME,    @enddate  DATETIME,    @subsholder NVARCHAR(260) = NULLSELECT  @startdate StartTime,             @enddate   EndTime,...

View Article


Global reporting for enterprise farm

Hello,I am trying to query through registered servers a simple global list of servers, versions and databases contained therein.I found  select...

View Article

Transact SQL Query

Hi,We are using sql server 2012. This query is used by financial applications. Each client has multiple accounts. There will be multiple transactions happening on each account (like deposit,...

View Article

Image may be NSFW.
Clik here to view.

Select query to transform table

Hello, I don't know who to go about selecting rows from a purchase table and transform the result as shown on the attached picture. I don't even know if this is possible. My boss wants me to get a...

View Article
Browsing all 23857 articles
Browse latest View live


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