Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Browsing all 3145 articles
Browse latest View live

Delete Row from one table if other table with multiple rows meet the condition

Hi I have 2 Tables as below , I need to delete TableA row with ConsumerID = 99 as my condition would be to delete the rows in Table A if DeleteFlag in Table B is 1 for the columns ConsumerID and...

View Article


Dynamic SQL to move data from from database to another taking into account...

I'm trying to move specific data from three linked tables on a source database to three tables on a destination database by generating dynamic SQL INSERT scripts but am getting stuck on the last set of...

View Article


Need a Query on group by condition

Hi ALL,I have one table which contines 3 columns they are 1.emp2.monthyear3.amountin that table i am having 6 rows like below.emp monthyear amount1 102013 10002 102013 10001 112013 10001 112013 10002...

View Article

Need Help

I have 2 tables, Parts & WOParts. Parts keeps a comprehensive list of all parts in all warehouses, WOParts are all parts that have been on work orders. I am trying to make a query that a report can...

View Article

Column data type I'd like to see in SQL Server 2014

[code="sql"][SPACETIME] nvarchar(INFINITE)[/code]

View Article


Null instead of 0

Friends, I have a excel sheet with some data and blank columns. I have a ssis package using to import data from excel to sql table. For blank excel columns it is importing as null instead i want to...

View Article

CURSOR and TABLE

Hi all,I consider CURSOR and TABLE as [b]data types[/b] but some one has argued that these are [b]database objects[/b].Can you please share your views on the same !!Thanks.

View Article

Using with in SQL Server Function

Why this doesn't work?I have to use code 2 as my atual scenerio is more complex as it brings data from multiple queries and should filter it in with clause before joining it.So with tab1 AS (Select *...

View Article


how do i find 5th working day in a month.

Hi Experts,i would like to know how to find fifth workingday* of a given month and year.workingday - working day is just any day apart from saturday and sunday. no need to consider any other...

View Article


With Clause in SQL Server Function (UDF)

I am trying to Write a function the needs with clause with in the function soCreate FUNCTION Temp(@Begin_Date DATE, @END_Date DATE)RETURNS TABLEASRETURN(---Also I need to declare var1 and var2 that...

View Article

how to write Pivot Query for Following

Hi Everyone I have wrote a query as SELECT PD.Name,PD.ContactNumber,Sum(cast(dbo.GetNumericValue(GI.AAY_Wheat)as numeric(18,0)))[Allocation], 'Week '+cast(DATEPART(wk, GI.EnteredOn)as varchar(50)) AS...

View Article

Subqueries

1. I need to find the names of the customers who have purchased academic books. (Coding required as Subquery NOT as Join)2. Here, I need to show a list of authors who have written booksand list the...

View Article

Conditional where

I need two tables to query together, but not if the value is blank(it is empty, not NULL) so I need a conditional WHERE statement likeWHERE IF(p.PartNoAlias='',,w.PartNoAlias=p.PartNoAlias) what is the...

View Article


SQl question

Hello Guys,Can you help me to solve these questions?Employee Customerid name age salary id name city industry type1 ben 61 140000 4 bamsonic Cologne J 2 bob 34 44000 6 ranasung Leslieburg J5 chris 34...

View Article

Cursor to Delete data

Hey Guys,i have to delete data from a table which is older than 2 weeks, how can i use a cursor to do it.I will have to place the query in a SQL job and run that weekly once, please help me out.

View Article


Poor query plan generated for SQL Server 2014 CTP2 clustered columnstore index

I posted this on Microsoft's SQL Server forum but I want to post it here as well to see if anyone has ran into this either in SQL 2012 nonclustered columnstore or SQL 2014 clustered...

View Article

Microsoft SQL Temp Tables (without declaring columns – like Informix)?

I recently changed positions, and came from an Informix database environment, where I could use SQL statements to select one or more columns ... and direct the output to a temporary table. In Informix,...

View Article


odd situation

How can u have the same tablename in sysobjects w/ different id's. It's making one of my processes fail. The difference in the records is the uid. I didnt think this could happen. doesn't happen in...

View Article

Data type validations

Hi,I have two columns in the same tableOne is data_value (varchar) and the other is sql_data_type (varchar). Data_value holds info like dates, decimals, etc..sql_data_type holds info about what type of...

View Article

Adding alphabet to a number to make it unique

create table #temp_Alpha_num ( [uniquenum] [int] Not NULL, [Somenum] [int] Not NULL,)Insert into #temp_Alpha_num(uniquenum,Somenum)values ( 1 , 121) Insert into #temp_Alpha_num(uniquenum,Somenum)values...

View Article
Browsing all 3145 articles
Browse latest View live