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

Pass table variable to exec SQL Server

I am trying to write this stored procedure but I have trouble passing result of temp table (or table variable) to EXEC(@query) task:I also used table variable (see commented area) but not luck.I want...

View Article


query compare date

I have a table, in each row, I have an CaseID, MTDThresholdDate, and YTDThresholdDateBoth of the date could be null, I would like to return what is the earlier date or smaller date.If either of them is...

View Article


SQL Transpose the data

Hello guys,I am the newbie in this field so I really appreciate your help.As you can see from the attached file, my data currently looks like in the tab "Original data"And now I need some query to...

View Article

unable to change(update) the column value in SQL server Database

Hi,I have a table with many columns . I can insert the records in this table but cannot update few fields. It does not throw any error and message is "1 row updated". When I check the fields it remain...

View Article

Group multiple Rows into 1 string based on ID field

Hello,I am trying to group multiple Rows into 1 string based on ID field. Here is my sample code:CREATE TABLE #MyLocs (RegionID int, Loc varchar(10))INSERT INTO #MyLocs (RegionID, Loc) VALUES (1,...

View Article


Query Stuck causing Locks, but I see SP:StmtCompleted in SQL Profiler

Hi,I am experiencing an lock issue.The head blocker query is the following:INSERT INTO DIMENSIONHIERARCHYLEVEL...

View Article

Stored Proc Execution does not finish before next line excutes

I have a stored procedure that drops temp tables using dynamic sql. Immediately following that stored procedure is a CREATE TABLE for the temp table and then a INSERT into that temp table but I am...

View Article

PAGE BREAK AFTER EACH GROUP ORDER BY

Dear All,I would like to get query with page break which after each group(preffered_name) results end, my sample code given below which gives without page break ..SELECT preffered_name ,ci.person_num,...

View Article


Recursive query with two parents

I am currently struggling with a query to recurse up/down a tree. In real life we have a junction table with two FKs pointing to the parent. Both Id and Parent Id are not nullable. Below is an example...

View Article


Total Sum exclude from condition.

experts, i am trying to calculate Overtime hours . we have got employee who has Friday and Saturday holidays. so mentioned here in table column Friday , saturday value 1.i need to exclude the dutyhours...

View Article

How to select record that exist in other table

I have two tables [quote]CREATE TABLE [dbo].[StatusAudit]( [RowID] [int] IDENTITY(1,1) NOT NULL primary Key, [AccountID] [varchar](20) NOT NULL, [Status] [int] NOT NULL, [AuditDte] [datetime] NOT...

View Article

|HELP| how create four part name to oracle?

heyi have link server to oracle from mssql.i want to update or insert with four part.1. how can i do it? 2. i read somewhere recommend to create views from oracle about the table i want thanks

View Article

creating a sequence of number starting or each group of ID

I have 3 source table and have to union them all source 1:Id name car 1 aaa BMW 1 aaa Porche 1 aaa Nissan2 bbb Nissan2 bbb Hondasource 2:Id name car 1 aaa Camry source 3:Id name car 1 aaa Honda 1 aaa...

View Article


Completing Fixed Sets With Another Table

Hi,I'm having some trouble finding a solution to a problem, its been a few hours now and I think I just completely loose track of what I'm doing and ended up a few times bashing and mix matching...

View Article

Converting time from datime into INT

declare @dte datetime Select @dte = GETDATE()@dte = 2016-10-31 11:42:51.920Is it possible to convert Time (11:42:51.920) into an INT so that it looks like 114257 ?

View Article


Redshift Script

Hi I am using a script to get details about database name, schema name, table name, row count and size of each table in GB. I would like to add one extra column '% of Disk Utilization' to the table...

View Article

Update a 3 column table from a single column

Wasn't sure how to word the title :)I'm working on a method to take user input to update a (target) table named UDFTemp. With some help in a different thread I think I have merge working when I use the...

View Article


MERGE only when not null

I have a target and a source table where I want to update the target from the source. I have one non-nullable key field, and 3 data fields UDF1,UDF2, and UDF3.I get updates provided to me which list...

View Article

Total by Group.

Dear All,I am trying to bring the group total .below my query,[code="sql"]WITH Prep AS(SELECT preffered_name as Department ,email_address1 as subdepartment,friday,saturday,government_num as...

View Article

Merge two tables and insert/update respectively

I have two tables and I have to merge the records.source:ID seq name designation company001 1 aaa Developer YYY001 2 aaa lead yyy002 1 mmm consultant bbb003 1 ppp developer yyy003 2 ppp lead yyy003 3...

View Article
Browsing all 3145 articles
Browse latest View live