Monday, June 3, 2013

[SQL Server] query to search

[SQL Server] query to search


query to search

Posted: 02 Jun 2013 08:17 PM PDT

I have a table with fields and data type likecompanycode [nchar(4)] actcode [nchar(12)] vounum [nchar(14)] trnam [decimel (18,6)]I like to build a query which will bring almost 900 rowsand build query like select comcod, actcode, vounum,trnam where comcod=3305 andvounum in ('BC201203000073','BC201204000001','BC201204000002','BC201205000001','BC201206000001','BC201206000002') ----------Here I would like to put 900 (nine hundred) vounum data and run the query, theproblem is data type. It is time consuming to edit every data by putting ' ' and append coma (,) for every vounum. Is there any way to paste the vounum without putting single quote ' vounum ' and appending a coma (,) for every vounum and successfully run the query.

How have Trigger's example after insert send to mail on outlook?.

Posted: 29 Jan 2013 11:37 AM PST

I create trigger after insert into table i want send mail on outlook and example trigger please.thank you.

INSERTING RECORDS WITH TRIGGER

Posted: 03 Jun 2013 03:54 AM PDT

INSERT INTO ACC_JVDTL_TRN ( FINYRTRN_ID, VRDT, LEDGER_ID, AMOUNT) VALUES ((select i.FINYRTRN_ID from inserted i), (select i.BILLDATE from inserted i), (select i.BILL_LEDG_ID from inserted i), (select i.BILLAMOUNT from inserted i)) The above portion is a part of a trigger. All are working fine except the AMOUNT which always insert 0.00 instead of the actual amount. Please help.Thanks in advance PRASAD SJ

Loading .csv File

Posted: 03 Jun 2013 05:19 AM PDT

Hi, I was trying to load a .csv file into my database. It was a comma delimited file and for one of the columns there is a comma(,) in between the data just like Texas,Houston can some one help me how to get rid of the comma in between. the package which i have created recognizing the value after the comma as a new column but it should not be like that. Can any of the guys help me in this. I was getting error in the Flat file source itself. I thought of using Derived column but the package is failing at the source point itself.

Calculating Sales History for Months/Years

Posted: 03 Jun 2013 01:42 AM PDT

I have a table - TrnDate, TrnYear, TrnMonth, StockCode, InvoiceQtyThe TrnYear and TrnMonth are the Financial Periods and dont always tie back to the TrnDate, Month/Year.for example - 31/05/2013 - might fall into Period 6 / 2013What I am after is a script that will calculate historic InvoiceQty for ;StockCode, MonthToDate, LastMonth, Previous6Months, Previous12Months, Previous18Months, Previous24Months, Previous36Monthsthe hard bit is when you want to go back 6 months and the year changes ....hopefully this makes sense ?

SQL: Excel file has bigger size using OPENQUERY to update it

Posted: 02 Jun 2013 09:23 PM PDT

Maybe the solution can be so easy but I can't find it so I write here for some help.We have this sql function:CREATE FUNCTION [dbo].[updateExcel]( -- Add the parameters for the function here @cell VARCHAR(4), @description VARCHAR(200))RETURNS BITASBEGIN DECLARE @sql NVARCHAR(1000) SET @sql = 'UPDATE openquery(LinkedServer2ExcelFile, ''SELECT * FROM [Sheet1$'+@cell+':'+@cell+']'') set F1 = '''+@description+'''' --PRINT @sql EXEC sp_executesql @sql RETURN 0END----that we use to update some excel fileEXEC @Result = updateExcel 'somecell', 'somevalue'The problem is that after this update the excel has a bigger size. But when we open it and save it again, the file's size get normal againI hope to find here some answers ...Thanx !!!

Get Value from another table

Posted: 02 Jun 2013 08:43 PM PDT

I have two tables, lets say Table 1 and Table 2 as belowTable 1:Col1 Col2 Col31 _A 112 _B 123 _C 124 _A 11Table 2:ID Val_A A_B B_C C11 AA12 BB13 CCI need an output From Table1 and Table 2 as below1 A AA2 B BB3 C BB4 A AAI am very new to SQL Server. Can you please help me in getting this output?Thank you in advance

No comments:

Post a Comment

Search This Blog