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

inserting into a not null field

Hello,I'm doing a bulk data insert into a table that includes not nulls and for those fields the source table includes some data in that column that is null.  Is there away to have the script insert...

View Article


how to call a stored procedure on time basis with out using sql job and GOTO

Hi,   I wanted to call a stored proc, on time basis , please tel me how it can be done with out using sql job , goto .1) That is, is there any timer aviable in sqlserver.q2) And which one is better...

View Article


Additional check in Delete Transaction

I'd like to add 2 if statements to the this delete transaction and check the @rowcount value before the COMMIT, is this the correct way to do it:DECLARE @APP_ID uniqueidentifier SET @APP_ID = '1234'...

View Article

Adding columns to a query from the results of another query

Alright, I'll try to explain this as simple a possible. I have a table called approval_levels in which I have 2 columns:         |LEVEL_ID  |NAME          |    |1         |app_level_1   |    |2...

View Article

Need help with query optimization

I have one simple query to optimize but somehow after creating couple of index this query is still having more logical reads and time.DECLARE @CURRENT smalldatetime set @current = '6/30/2013' select...

View Article


MS SQL Server 2014: Error inserting into Temp table with index and identity...

Dear colleagues,The code below works perfectly fine on MS SQL Server 2008 R2 and MS SQL Server 2012, but gives an error every second time the proc is executed on MS SQL Server 2014. If I do not define...

View Article

SQL Server Data Tools (2012) and Business Intelligence Studios (2008)

Hi,Can SQL Server 2012 Data Tools be installed alongside BIDS 2008 on my workstation or will I encounter issues?Thanks

View Article

Comparison of two different string length

Hi,I have comments column in 2 diff databases A and B. the column in A database has an addition of "ack date" whereas the the same column in database B does not have it. I need to match these 2 columns...

View Article


Divide in equal part

Hello All, I want to divide a number in equal parts . It is dividing fine but when I am adding the resulted values its sum is not matchingLets say 1/1075 when I sum the 1075 resulted value its sum is...

View Article


merge 2 rows into single row with data update?

hello all,i have a table with below data,declare @tbl table (uid int, uname varchar(10), start_dt date, end_dt date) insert into @tbl values (1, 'env1', '4/4/2010', '5/5/2012') insert into @tbl values...

View Article

Query to get the last added record in a table for a particular id

THi,I have 2 tables A, BTable A has id,nameTable B had parentid(foreignkey referring to ID in above table), record_type,created_timestampI want to get the last added record_type from Table B for all...

View Article

Inner Join Issue

Hi All, Please help me with an issue I am facing with joining tables....been trying my best to sort it out since last couple of days but to no avail. Surely I am missing out something very trivial...

View Article

to get the year and month which is greater than today's year & month

I have table like Declare@Calendartable (FISC_YRint, FISC_MTHint);WITHCTE_FISYR(FY)AS(      SELECTFY=2005      UNIONALL      SELECTFY=FY+1FROMCTE_FISYR WHEREFY<2050),CTE_FISMON(FM)      AS      (...

View Article


Encoding character type in sql server column

Hello,I am having troubles during REPLACE character in sql server column due to fact that, it seems to me, SQL Server does not recognize two "the same" characters i.e., some of them it translates into...

View Article

Dependencies between Objects

Hi Folks,My client has asked me to move from one db to another. (I don't know why, may be they are restructuring). Now the problem is that there are many stored procedures, functions and tables which I...

View Article


column to rows tsql

select table_name,column_name from INFORMATION_SCHEMA.COLUMNS where DATA_TYPE = 'varchar'Output table_name column_name t1 c1 t1 c2 t1 c3 t2 col1 t2 col2 t3 column1 Expected OutputI want to generate...

View Article

performance operations based on Column values in SQL server 2008

Hi , I have a table which consist of following columns ID    Formula              Values                 DisplayValue1                    a*b/100       100*12/100          null2...

View Article


Class not registered error

I would like send mail through procedure with out using SMTP but i am getting Class not registered (code:0x80040154,ODSOLE Extended Procedure) error

View Article

Deadlock with Partition Lock

Hi, We are facing deadlocks regularly in our production server. We suspect this could be Partition lock. Can someone please help on this.Environment Info : Microsoft SQL Server 2008 R2 (SP2) -...

View Article

joining three tables

I have to join three tables but i m getting error as given below:Error i m getting-Syntax error(missing operator) in query expression 'invoice.INVOICE_NO=inv_ent_main.INVOICE_NO INNER JOIN invrate ON...

View Article
Browsing all 23857 articles
Browse latest View live


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