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

not including certain dates in where clause

when I run the following query, i get 10 records, from which 4 dates record are equal between two columnse.g s.[sTrialExpiryDate] =  s.sP_ExpiryDateselect u.[uForenames], u.[uSurname], u.uEmailAddress,...

View Article


Need help with getting sum of values in rows for a particular DB

I have a table, TAB1, that stores DB size info, something like this:Servername,DBname,DBFile,FileSize ------------------------------------------------------ ABCDEFGHIJ,AAA,1.mdf,100...

View Article


IF UPDATE (columnName) in update trigger

My understanding is that the Update trigger has a DELETED table and an INSERTED table, where the INSERTED table contains all the new data for the rows that were just modified, and the DELETED table...

View Article

How To Retrieve The Top 50% Of A Column - or, any other %-age.

How do, folks.If the title is somewhat too vague, lemme 'splain...Basically, let's say I have a data set where one of the columns is an amount paid - Amt_Pd- and another column is the date when that...

View Article

Image may be NSFW.
Clik here to view.

need generic dynamic sql query to generate nodes depending on dealer levels

Input table:create table #test(dealerid integer ,dealerlvl integer) insert into #test values(1,1) insert into #test values(1,2) insert into #test values(1,3) insert into #test values(1,4) insert into...

View Article


How to get feedback messages for schema creation script created by...

I am using sql server 2008 R2. I created a script file by using Tasks->Generate Scripts. I selected option so only create statements are generated for all objects – tables, indexes, views, functions...

View Article

i have a situation please suggest some transactional solution.

hi,    I have two databases one is entry database (DB1) Where entery is done, other database is reporting database (D2).we are trying to transfer data using stored procedure from db1 to db2. the  sp...

View Article

Pivot For Multiple Columns With Varying Items?

Hi friends,Got a table...

View Article


Kill all processes across multiple databases across multiple servers

Dear All,Could someone suggest, how processes can be killed across multiple databases across multiple servers.I know solution to do by doing on one server as below: USE master; GO ALTER DATABASE...

View Article


Why has CAST(FieldName to float) failed in view but not in SELECT?

I've just solved a problem but I'm still not sure what the problem is! I have a data (staging) table with all values stored as text. The data is converted to the correct data-type and also aggregated...

View Article

Comparing values in comma separated strings

Hi All,I have to compare two comma separated strings with exact match. Following is test scriptcreate table trial1 (val varchar(20) ) insert into trial1 values('1,3,4') insert into trial1 values('1')...

View Article

Query question

Hello,I've below queries,USE [Practice] GO CREATE TABLE #TEMP1 ( ID INT ) CREATE TABLE #TEMP2 ( ID INT ) INSERT INTO #TEMP1 VALUES ( 1 ) INSERT INTO #TEMP1 VALUES ( 2 ) INSERT INTO #TEMP2 VALUES ( 2 )...

View Article

Help using GROUP BY and COUNT

The following SELECT statement will yield a report showing 3 days of the week and the number of "Msgs" that occurred for each day. How can I make it so that there's a 3rd column showing how many of...

View Article


Easy t-SQL (need help)

Hi Gurus,colm01 Colum02 colum03 colum04 colum05 10001 America World 10 null 10002 Virginia Europe 20 10 10003 Florida Asia 30 10In this table, I want to have a new column (colum06), that gives me NULL...

View Article

using Cast('' to XML) when my stringb is more than 8000 characters

I have some sql code that is generated dynamically to build a grid.  the xml string that is put together in my sp is dynamic and it just so happens I have a situation where the xml string it put...

View Article


Trouble making a CLR Function

I'm trying to make my first CLR function using vs 2012 and sql server 2012 and am using an example from:http://www.skylinetechnologies.com/Blog/Article/246/CLR-Functions-in-SQL-Server-A-Tutorial.aspxI...

View Article

is this at all valid? select exec(@SQL) as MyValue into MyTable...

This is a question related to a workaround from a previous post.  I'm pretty dense, so type slowly if you answer.  :)Let's say I have a table named Sales with a field named SaleValue.  The average of...

View Article


Exporting to CSV not returning data in order

Hi,I am trying to export a table data into CSV file using a SSMS task(import/Export) and in the wizard i use a query option and write following query (select * from table order by ID) but when i open...

View Article

Exporting to CSV adding NULL as last line

I am having issue while exporting data to CSV file, i can see no data issue when running a select statement in query window. all 105 row comes back correct. but when i export to CSV field it add NULL...

View Article

Why I cannot use RowID in where clause but can use it in order by clause

I am on SQL Server 2008. 1. If I useSELECT (ROW_NUMBER()  over (order by ImportId, ScenarioId, SiteID, AssetID, LocalSKUID, WEEKID, MonthID)) RowID, *   FROM [JnJ_Version1].[dbo].[td_Production_Week]...

View Article
Browsing all 12890 articles
Browse latest View live


Latest Images

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