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

Table has BigInt - when created View int picked

Hello All, We have a table (tbl_production) and it has a filed (ID) which is of data type bigint. When we create a view on this table, we notice the (ID) filed is of data type int. Compared the schemas...

View Article


select exact character at exact position sql server

Hello,please, while in EDIT of table, how to set filter that selects all the rows which in certain column have exact character at exact position? (e.g., how to select only rows that in column1 have "5"...

View Article


Update Script Issue in SQL server 2008 r2

please see my below script whenever i run this script i got below errorupdate Scmdb..StockAge set Age1=SUM(a.gr_lin_acceptedqty)  from scmdb..gr_lin_details a  where...

View Article

If Statement to compare.

Hi All i have 2 local variables x and y values x = 5 and y= 10 and table abc columns A and B . i want to compare the values x and y with values in  table .something like if x between A and B or Y...

View Article

Please help - Joining three tables and get row values into Column. Please help!

Hi,There is a SourceTable1 (Employee) with Columns like EmployeeID,Name,DOB.There is a sourcetable2 (EmployeeCode) with columns like EmployeeID,Code,Order.There is a source table 3...

View Article


Adding leading zeroes (PADDING in SQL Server)

Hi to everyone,Is there a function to add leading zeros to int converted to varchar?I have 5, need to get varchar(5) = 00005..I hate to do like left('00000',5-len(Int))+cast(Int as varchar)I know in...

View Article

Scripting Create Stored Procedure to create backup copy on same database

Hello,I need to create a backup copy of a group of stored procedures on the same database.  Using TSQL I need to find all stored procedures that meet a criteria (WHERE pr.name = '%_SomeSuffix') and...

View Article

Query for Identifying column changes

Hi Guys, Need help in getting a query for my scenario.I have 2 table Table A and Table B. Both have same columns and data type.Table A: Id  PersonId    Name      Code      Date 1    1000           John...

View Article


How can can i subtract the value of the column in each row ?

I want to subtract  the value  of the column in each row if the row is not enough then continue to next row.For example ID             QTYA               20B               40       C               60I...

View Article


meet at lease 4 criteria

Hi,The question has 7 criteria, but the result set just need to  meet 4 of them, how to write the query ?Thank you.

View Article

How to modify the query to get the output in a single row

Hi All, Below is the query i have written it works fineselect DISTINCT right(left(CTACCT,13),4) AS LocationNum, tODS_GLBalance.FiscalYearId AS FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId AS...

View Article

Making T-SQL code more efficient and better

Hi,I've got some T-SQL code but i wanna make it more efficient and rather than having to have three distinct statements, turning it into one statement which is referenced three times.If i was doing...

View Article

Operand data type varchar is invalid for divide operator.

Hi ,I am insert one record and getting the Operand data type varchar is invalid for divide operator error. I am not doing any division in it.INSERT INTO PreCheck ( PreCheckID , Position , PreCheck ,...

View Article


While Loop for Insert

Hi ALL ,i have a table that stores the IP Address like below . The requirement is to insert the auto- incrementing values into an another table  Destination xyz .Parameter Value Inserts  @Value = 23...

View Article

Data Quality Check in T-SQL

I have a column which contains these values       2308,00-     165205.00-       4000.00-      10000.00-        950.00-     240208.33-i would like to exclude those records where it contains comma before...

View Article


Stored procedure runs fine from SSMS but fails when called from the C# app

I'm using SS Express 2012 so I doubt I have all possible debugging capabilities at my disposal, although I'm still trying to figure this out myself. The compiled C# application has logging to insure...

View Article

What kind of check should I do? Substring helping

Hi guys, I'm struggling to fin a solution to this problem: I'm building a package in SSIS that allow me to load, transform, check thousand of xls file. Everything is ok but now I ran into a logic issue...

View Article


Image may be NSFW.
Clik here to view.

How to loop folder , sub folder and files in the sql server ?

Hi,I have a folder , sub folder and files like this.Here AuditSearchHistory fixed folder and contains 2 subfolders , but some times it may contain more sub folders also.Please help me to loop the...

View Article

Help in query for errors

Hi, I am unable to insert records in #travel_2 table and getting the error. The error is because of exceed characters  but I want to know where is the error, in which column or in which row. Can you...

View Article

Dynamic SQL in table vauled function or CLR

So I have a query that gives me some analysis on the values in a column, in a table.  It reurns a small data set.It gives me the max, min, stdev, avg and some other stats grouped by another column.I...

View Article
Browsing all 12890 articles
Browse latest View live


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