Posts Tagged by sql-server
Function for row insertion
September 21, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am relatively newbie with SQL Server, and I have some experience and practices from Oracle & PostgreSQL which i want to use in the SQL Server. I need to create function which takes fields values for new row in the table and which also returning autogenerated ID value of the new record. First of […]
Shape – append queries equivalence nowdays
September 21, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have been converting a program written in VB to C# in the last few weeks. In some places I noticed queries written in a weird way, the words ‘Shape’ and ‘Append’ appeared. For instance: SHAPE {SELECT Test, IdQuestion, QuestionName, QuestionTimeLimit, ImageLocation FROM dbo.userViewConTestQues WHERE (Test = 5) ORDER BY QuestionOrder} AS ParentCMD APPEND ({SELECT […]
EclipseLink generated SQL doesnt include pagination
September 19, 2014 | Posted by forumadmin under TechQns |
Comments off
|
(My environment: Windows 7 x64 and Server 2008, EclipseLink 2.5.2, I’ve tried the following with JTDS and the MS JDBC driver, and with MS SQL Server Express 2008 and 2012.) I’m doing a paginated query in a table with anywhere from 5-50 million rows, with about 5 million rows matching the filter criteria. The following […]
SSRS-R2. Breaking down the data in strvalue field
September 19, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am new to SSRS 2008 r2. I have a problem, which hopefully is fairly elementary. In a table, I have two fields: FieldName and strValue. Fieldname’s data is fed by an external dataform where people enter a date and then a timeslot. Fieldname gives the heading in the table, strvalue gives the data. When […]
SQL Server Reporting Services report not sent
September 19, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a problem: report is not sent to recipients. Analysis of exchange server logs showed that timeout occurred while waiting for client input. As i understand Reporting Services opens sessions then forms a report and then sends it. But often reports are formed too long and timeout occurs. Is there a way to make […]
Database column data type
September 19, 2014 | Posted by forumadmin under TechQns |
Comments off
|
My SQL Server database has many tables with variety of data types being used. The current design has a standard datatype length for columns ex: NVARCHAR like 200, 1000 or MAX (this is a standard we are adopted) depending on what type of data I saved, I use datatype accordingly. For a NAME column I […]
How to create Portable (without installation) Dot Net application?
September 18, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I want to create an desktop application that interacts with SQL server, SSIS, SSRS. Installation of application is not possible in client system. A click once application should be created with dot net higher versions like 3.5 or higher. Usage of 3rd party software to compress all files to one is not permitted. Asked […]
Integrating SQL Reporting Service into a C# WebAPI app
September 18, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I want to integrate SQL Reporting Service into my C# WebAPI app. I already read http://msdn.microsoft.com/en-us/library/aa964126%28v=sql.90%29.aspx and http://msdn.microsoft.com/en-us/library/aa964126(v=sql.90).aspx but either I overlooked the relevant parts, or my questions are not answered there. So, for a start: I have already created a rdl file. When my report API is called, I want to preprocess data, put […]
SSIS Package Deployment Model : Could not find connection managers
September 18, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am using Package Deployment Model for one of my project in SSIS. When I am importing the package on SSISDB under Integration Service Catalogs. It imports successfully. Then, I want to create a Job under SQL Job Agents to Run this Package periodically. But there I am not getting any Connection managers which I […]
Creating new column for rolling average in SQL
September 16, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am using SQL Server 2005. Consider the following table with three columns: issueid, date and rate: sqlfiddle.com/#!2/611682. I would like to create a new column that displays the moving average of rate for each issueid at each date. I want to call this column mse_m. The result I am looking for is: For issueid […]
Can encryption be done on unique constraint/key columns?
September 16, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I need to encrypt the column level encryption on email column. But email column is unique constraint in the table. Can this be encrypted. Does the encryption, in general, creates the similar encrypted string for the same string always? Asked By – Prem Read Answers 0
How to retrieve unique records having unique values in two columns from a table in SQL Server
September 16, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I want to query a table where I need the result that contains unique values from two columns together. For e.g. Table EnquiryId | EquipmentId | Price ———–+————–+——- 1 | E20 | 10 1 | E50 | 40 1 | E60 | 20 2 | E30 | 90 2 | E20 | 10 2 | […]
How can I interface an Android App with SQL Server
September 16, 2014 | Posted by forumadmin under TechQns |
Comments off
|
first of all sorry if I will do some mistakes, but my first language is not english. This is my problem: I have to make an Android App that recover some data from an existing database situated on MS SQL Server on Windows Server 2003. I don’t know so much server-side programming languages so I’m […]
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near D:
September 16, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I trying to call a stored procedure: CREATE PROCEDURE [dbo].[uspImportDepartment2] @filePath nvarchar(255), @formatPath varchar(255), @countInsert Int OUTPUT AS BEGIN SET NOCOUNT ON; DECLARE @sqlstmt nvarchar(255) DECLARE @results table (result xml) –Build the Dynamic SQL Statement to get the data from the xml file SET @sqlstmt= N’SELECT * FROM OPENROWSET ( BULK ‘ + @filePath + […]
Get the latest date for each record
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a History table (like a log) that records changes to parts: TransactionID Part ID Description Last Updated 1 1 Fixed O-ring 2006-03-14 20:00:04.700 2 2 Replaced coil 2009-01-02 20:00:04.700 3 1 Replaced coil 2009-01-02 20:00:04.700 4 1 Replaced LED 2002-08-20 20:00:04.700 5 2 Sealed leakage 2007-03-08 20:00:04.700 6 3 Replace connector 2004-05-16 20:00:04.700 […]
Moving/Rolling Average in SQL
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am using SQL Server 2005. Consider the following table with three columns: issueid, date and rate: sqlfiddle.com/#!2/611682 The result I am looking for is: For issueid 1, the average on 3/31/2014 is the average of the rate values on 01/31/2014, 02/28/2014 and 3/31/2014. In other words, for each security and at each the date, […]
TSQL Inner Select with SUM
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am trying to get the sum of 2 values in my inner select but get an error about the aggregate function. I am just trying to understand how I need to format this differently to get it working. Is there a different order I need to do this in? (SELECT CONVERT(VARCHAR,D.[booksCost],1) AS booksCost, CONVERT(VARCHAR,D.[tuitionCost],1) […]
EF 6 – Stored Procedure Duplicate Result Column
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I’m in the process of migrating from a legacy system. The database cannot be modified – including adding/modifying stored procedures. I’ve added a stored procedure to an EDMX model successfully, it generated the following code: public virtual ObjectResult<sp_CPC_GetUserInfoByUID_Result> sp_CPC_GetUserInfoByUID(Nullable<System.Guid> sessionID, Nullable<System.Guid> userUID) { var sessionIDParameter = sessionID.HasValue ? new ObjectParameter(“SessionID”, sessionID) : new ObjectParameter(“SessionID”, typeof(System.Guid)); […]
How to use Results column with Having clause
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a stored procedure, I want to use HAVING clause with columns IsUserFruitEater and IsUserOnSite but it says column not exists. Not sure how to use columns, there must be a way to use Stored Procedure result’s columns… ALTER procedure [dbo].[Risks_GetFruitCratesForUser] ( @UserID VARCHAR(200), @URLFilter varchar(256) ) AS SELECT DISTINCT Fruits.* ,FruitsCrate.* dbo.IsUserRegularFruitEater(@UserID, FruitsCrate.FutureID) […]
Login return error with aspnetdb_log.ldf
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
When I try to login with my asp.net login form, i get error in line if (!Roles.RoleExists(role)){ … } Error is : One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing […]
Check if stored procedure is running
September 15, 2014 | Posted by forumadmin under TechQns |
Comments off
|
How to check if a stored procedure or query is still running in SQL Server? Ideas I’ve thought of having a log where to write when the procedure starts and delete when it ends. Flaws: it leaves open the case when the server restarts or some kind of failure inside the procedure. this method needs […]
How to use SqlDataSource with a stored procedure in ado.net
September 14, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I want to know how to execute a stored procedure using SqlDataSource. When I configure SqlDataSource and test it, it’s working fine. I want to know how to bind SqlDataSource to button click event Stored procedure: Alter proc FindVendor @name nvarchar(50) AS BEGIN select * from vendor_master where Vname like @name + ‘%’ END ASPX […]
Creating error record when SQL Server udf function returns a certain result
September 14, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have been wrecking my brain over this all weekend. I have a SQL Server UDF to check whether a value passed as an argument will truncate. CREATE FUNCTION willTruncate (@fldValue nvarchar(200), @fldSize smallint, @fieldname nvarchar(40), @tbl varchar(15)) RETURNS varchar(200) AS BEGIN declare @Return varchar(200) declare @fldLen smallint SET @fldLen = len(@fldValue) if @fldLen <= […]
Passing data from one asp.net application to another?
September 13, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have 2 asp.net applications. They both use the same data, but they use a different database schema and use the data in a different way. What would be the best way for to pass the data from one application to another. SSIS – Should I use ETL to take the data from one application […]
Unable to insert data into a certain table
September 12, 2014 | Posted by forumadmin under TechQns |
Comments off
|
So I am literally a new DBA and my machine has not been properly setup yet so every time someone sends in a request for an unknown error I am in charge of searching google for answers (hopefully changes by next week! sigh). So after searching on the internet for the past 2 hours I […]
Limit select size of all user queries
September 12, 2014 | Posted by forumadmin under TechQns |
Comments off
|
Stupid question as it sounds but is there any way to implement select size limitation to specific users on SQL Server? Even though a user sends select *, the result set will contain only the first, say 10 results. Works just like the top operator but in a security context. There might be two benefits […]
Matching Two Tables Document types
September 11, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have two table. FD_Documents FICA11 In FD_Documents there are two columns FD_CBAF8917 = Document type and FD_B61DDE99 = ID_Number ***sample data*** 2456525425625,other 2456525425625,id 2456525425625,POA 2456522456585,other 2456522456585,id 1245879566554,poa 1245879566554,ID In FICA11 In FICA11 there are two columns DOC_TYPE = Document type and ID_NUMBER = ID_Number ***sample data*** 2456525425625,other 2456525425625,id 2456525425625,POA 2456522456585,other 2456522456585,id 1245879566554,poa 1245879566554,ID Now […]
How come doing a find/replace on sql dump and importing it gives error #2006?
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have the sql dump for a wordpress install that lives on a domain. I need to make some changes to the site so I have set up a localhost using MAMP. If I import the sql dump “as-is” it imports without a problem. However I need to change all the URL’s in the sql […]
Extract tables from view using SQL Server 2008
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a view which consist of two tables. Example: Table1: create table t1 ( a varchar(10), b varchar(10) ) Table2: create table t2 ( a varchar(10), b varchar(10) ) With some data: Table1: insert into t1 values(‘xyz’,’abc’) insert into t1 values(‘ttt’,’aaa’) Table2: insert into t2 values(‘stu’,’def’) insert into t2 values(‘sss’,’bbb’) Creating view: create view […]
Query which should return count value in integer
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have to return count value of various languages in one query using with and finally it should display total no of count in integer. It should be combined from different tables in the same Db and finally it should return the total in one query . Could anyone help me in this . Thanks […]
Horizontal Average SQL View
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have the following table: ID Value1 Value2 Value3 1 10 0 5 2 12 10 20 3 0 5 9 4 20 12 8 5 2 15 0 I want to have the following result: ID avgValue 1 7.5 2 14 3 7 4 13.33 5 8.5 The formula is normal average but the […]
SQL Server 2008: Pivot query
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I feel like I am close to solving the problem, but I can’t get past this one issue. I have searched the forum and have come across some sources that have helped me get closer to what I am looking to do but now I am stuck: This is the original SQL I used to […]
Error while creating union in sql server view
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have been trying to create a view using the query below: WITH Emp AS (SELECT TOP (100) PERCENT b.EmpCode, RTRIM(b.LName) + ‘, ‘ + RTRIM(b.FName) + ‘ ‘ + RTRIM(b.MName) AS fullname FROM table1 AS a INNER JOIN table2 AS b ON a.EmpCode = b.EmpCode UNION SELECT SubConId, RTRIM(SubConLName) + ‘, ‘ + RTRIM(SubConMName) […]
double entry in DB
September 10, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a legacy vb6 program. When this program launched, it will check the DB. If the user record exist, it will update, otherwise it will create a new one. It has been behaving like that for years. But recently it occurred a few time, that it created 2 identical entry in the DB. since […]
SQL server 2008 replication without reinitialize
September 9, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have two databases in different servers – center_db on siglv01\sql2008 and center_db on sig\sql2008. Can I restart replication without needing to reinitialize it? The connection dropped more than 3 days ago and is now too slow: so I want to start replication without a reinitialize. Asked By – Amr Ezz Read Answers […]
How Can I get Pivot Type Data using T-Sql
September 9, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I got requirement that needs to display top 3 salary Employee. It got query which displaying top 3 employee names like this: select top 3 [Employee First Name]+’ ‘+[Employee Surname] as [Employee Full Name] from [Emp ] group by [Employee First Name],[Employee Surname],[Annual Salary] order by sum([Annual Salary]) desc Result: [EmpFullName] ————— Darren Ben Sam […]
Execute stored procedure as login?
September 9, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have created a database ‘Test’ and in that database, I created a schema ‘ABC’ with user ‘userABC’ and a stored procedure dbo.backupdatabse. So, I would like to login with ‘userABC’ and execute dbo.backupdatabase but not grant permission for user ‘userABC’. How can do it? Thanks in advanced. Asked By – Wofl Read […]
Workaround to RAISERROR WITH NOWAIT buffering
September 9, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I’m using RAISERROR to produce progress output from stored procedures rather than using PRINT, to avoid PRINT’s buffering of the output. Now I’ve discovered that RAISERROR will start buffering after 500 prints. Is there a way to get around this behavior ? The Query below will show my point: DECLARE @i INT = 0 WHILE […]
Escaping special characters in a SQL LIKE statement using sql parameters
September 6, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a table containing products. I need to make a query finding all the matching results to an user-input value. I am using SqlParameter for the insertion of the inputs. SqlCommand findProcutsByPattern = new SqlCommand( “SELECT *” + “FROM [Products]” + “WHERE ProductName LIKE @pattern”, connection); findProcutsByPattern.Parameters.AddWithValue(“@pattern”, ‘%’ + pattern + ‘%’); The problem […]
How can I know or get the Array Size before a SqlDataReader? and return it as a json
September 5, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I want to know the size of my array to loop just the needed times but I don’t know how to do it in an efficient way, the only way that i can think is to put it inside of the reader and count, then use another time the reader and insert the values I’m […]
Update query executed successfully but data is not updated
September 5, 2014 | Posted by forumadmin under TechQns |
Comments off
|
i am working on a project in which i have use the Update Query but the problem is that after the query is executed successfully the data is not updated here is my code protected void Update_btn_Click(object sender, EventArgs e) { var aid = Convert.ToInt32(Session["Aid"].ToString()); try { var conn = ConfigurationManager.ConnectionStrings["AccountsConnectionString"].ConnectionString; using (var con = […]
Why does the same Linq-to-SQL query consume much more CPU time on the database server for a different project?
September 5, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a legacy .Net 4 project (name it “A”) which uses Linq-to-SQL to query a database and I have another .Net 4 project (name it “B”) with similiar but not the same code which queries the same database as “A”. Both projects: are C# projects {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} use the same assemblies (version v4.0.30319, same folder) […]
Issue with dynamic web service URL
September 5, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have a service that I am using to make calls to several web services, each web service has a DEV, TST and PRD equivalent. Currently I have been making an instance of the web service and then swapping out some sections of the URL in order to change between environments depending on what is […]
SQL Server not found or accesive error on MVC Movie tutorial program
September 2, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I am currently getting my head around MVC ASP.NET and following this tutorial: http://www.asp.net/mvc/tutorials/mvc-5/introduction/accessing-your-models-data-from-a-controller. I followed the whole tutorial to the letter but after I created the MoviesController like the tutorial said, and I press F5 and go to localhost:xx/Movies to try the code I get the following error: Exception Details: System.Data.SqlClient.SqlException: A network-related or […]
Send Forget Password using E Mail in Asp.Net
September 1, 2014 | Posted by forumadmin under TechQns |
Comments off
|
i am using a asp.net framework for sending a forget password through E-Mail. but i think there’s some problem in my code. please help . The button_click event code is give below. protected void frgtbtn_Click(object sender, EventArgs e) { string st = “select E_mail FROM registraion_master WHERE E_mail='” + Email.Text + “‘”; cmd = new […]
How can I check adaptive response buffering is being used by Microsoft Sql Server?
August 27, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I’m using Talend’s ETL functionality and I want to make sure that sql server access is pulling results through adaptive response buffering. This is a Java based software and I’ve configured the connection string parameter with responseBuffering=adaptive but I can’t observe a difference between memory usage or performance when change responseBuffering to full or change […]
SQL Sever and JAVA website connection JDBC
August 27, 2014 | Posted by forumadmin under TechQns |
Comments off
|
I have created a JAVA application that connects to a SQL server database. I used ‘Microsoft JDBC Driver 4.0 for SQL Server’ to connect my application to the database. I included the ‘sqljdbc4.jar’ file in my PC Classpath and in my Java Application Library, a made other nessa there after in connected perfectly. i am […]