[Solved] I am working in wcf service i created one function its working fine but i have to reduce line sizes in that function

It is difficult to understand your question but I suspect you are trying to return an array that is larger than that allowed by your current transport binding settings. BOTH in your server and client you should look at increasing your readerQuotas eg: <readerQuotas maxDepth=”32″ maxStringContentLength=”10000000″ maxArrayLength=”10000000″ maxBytesPerRead=”10000000″ maxNameTableCharCount=”10000000″ /> and possibly also your buffers … Read more

[Solved] SQL Join query to return matching and non-matching record

Your problem is coming from including columns in SELECT statement from table_2 that do not have values for rows that exists in table_1. You need to change SELECT Table_2.ScriptNumber to SELECT Table_1.ScriptNumber As future reference make sure you always select all relevant columns from LEFT tables and only columns you need from RIGHT table. Otherwise … Read more

[Solved] Current month and last month data in single row

You can use an aggregate function with a CASE expression similar to this: select itemname, sum(case when month(date) = month(getdate()) -1 then amt else 0 end) LastMonthAmt, sum(case when month(date) = month(getdate()) then amt else 0 end) CurrentMonthAmt from yourtable group by itemname; See SQL Fiddle with Demo 0 solved Current month and last month … Read more

[Solved] Variable Declaration [closed]

Collect your error messages, if you get none return the result of your query, else return or raise the collected errormessages. Declare @a Table (a int,b int,c int) insert into @a Values(1,2,3),(4,4,4) Declare @va int=2 Declare @vb int=2 Declare @vc int=2 Declare @error Varchar(100)=” if not exists(select * from @a where a=@va) Select @Error=@Error + … Read more

[Solved] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, = ,

I see this in a comment: i need more than one value Okay. Let’s run this as a real query then: SELECT NombrePelicula, (SELECT SUM(pelicula.PrecioEntrada) FROM pelicula) / count(*) As Recaudacion FROM funcion GROUP BY NombrePelicula HAVING COUNT(*)>1 solved Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, … Read more

[Solved] How to convert comma separated value into rows in sql server

You have tagged your question with SQL Server 2016, in SQL Server 2016 there is a new function STRING_SPLIT. In SQL Server 2016 your query should be as simple as: declare @tab table ([user_name] varchar(10),Unit varchar(100)) insert into @tab VALUES (‘ABC’,’1,2′) SELECT t.[user_name] , Value as Unit FROM @tab t CROSS APPLY STRING_SPLIT(t.Unit , ‘,’) … Read more

[Solved] Validate that connection string is for Sql Server 2008 [closed]

I don’t know why you need to validate or users are entering a connection string but you can find connections strings for sql 2008 from below link. http://www.connectionstrings.com/sql-server-2008 Standard Security Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; Use serverName\instanceName as Data Source to connect to a specific SQL Server instance. Are you using SQL Server 2008 Express? Don’t … Read more

[Solved] How can I get full entry from a column from on 10 characters given when the actual entry contains 20 characters and the field is in varchar? [closed]

How can I get full entry from a column from on 10 characters given when the actual entry contains 20 characters and the field is in varchar? [closed] solved How can I get full entry from a column from on 10 characters given when the actual entry contains 20 characters and the field is in … Read more

[Solved] NULL Conditons in SQL Server [duplicate]

You need to pass the value of the Combobox in @Status: Here you need to set conditions like this: DECLARE @Status varchar(15) –set the Status SELECT * FROM tbl_Location WHERE (@Status=”All” OR (@Status=”Nulls” AND YEAR IS NULL) OR (@Status=”Not Nulls” AND YEAR IS NOT NULL) ) 3 solved NULL Conditons in SQL Server [duplicate]

[Solved] Find contact in location tree

You could use a recursive common-table expression to walk up until you find a parent with a contact. For example: ; with CTE as ( select ID , ContactID , ParentID , ID BaseID , 1 as Level from Location where ID in (4,5) union all select parent.ID , parent.ContactID , parent.ParentID , child.BaseID , … Read more