Assign Value returned by TVF to variable in TSQL
I have to assign a value returned by SELECT * FROM MyTableValueFunc() to a variable in TSQL.How can i do that ?e.g Declare myVariable varchar(1000)SET myVariable = (SELECT * FROM MyTableValuedFunc());...
View ArticleUpdate Table Value Using Date Column from another Table
Hi,I need to Update Column Value based on another table. Existing_Table Id Date N 9/10/2008 N 9/11/2008...
View ArticleODBC error calling executable from a stored procedure
Hello, I have an executable created with VB.Net that opens an Access database and executes some queries. It is located on the database server and works perfectly if I run it from a command prompt (on...
View Articlet-sql pick select max date
In t-sql 2008, I have a table that I need to join to itself server items based upon customer number, cust_date, and attribute id. The attrribute id values are 53, 54, and 55. There are the same...
View ArticleSQL Compare Sytem Tables (sys.table) from (2) different database for comparison
How do I compare SQL system tables sys.table from two (2) databases?Here the code I tried to use but I get an error message:SELECTDB1.*, DB2.*FROMsys.tablesINNERJOIN DB1onDB2.name= DB1.nameMsg 4104,...
View ArticleDifference between SELECT .. INTO and INSERT.. SELECT
Hi All,I am on SQL Server 2008 R2. I have a very basic question.What is the difference between SELECT ... INTO command and INSERT ... SELECT command, when inserting data into a tamp table or even a...
View ArticleOLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"...
I am trying to execute this Select against my excel fileSELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0; HDR=NO; IMEX=1; Database=C:\Temp\test.xlsx', 'SELECT * FROM [Sheet1$]')I have...
View ArticleHow to set a DateFrom Parameter based on a date in a different database table
I have a lengthy SELECT statement I am running on we'll say machine1 and then in a CTE it joins to data on machine2. I have turned the query into an INSERT statement for loading data from machine 1 to...
View ArticleAge calculation in report builder query
I am using SQL reporting services 2008 and report builder I have setup a report where I want to calculate the age of each student. I have table called Students with a DOB field. I want to display the...
View ArticleTable with 449 Million Records
Hi All,I have a table with two columns and 449 million records. Table Structure :Create table EmployeeList (Id INT,Divison VARCHAR(250) )I have a chance of two same ID's with different divisions, In...
View ArticleHow to write query for inventory
I am working on a database project for my final project prior to graduation. I am trying to figure out how to write a query that will show what the current parts quantity is on hand after orders are...
View ArticleStrange problem with case statement
I got into an issue with the below statement. I don’t understand why it is not working as expected. Structure for table is below Months Cash 1 4.13 2 46.02 3 46.02 4 5.31 5 5.31 6 51.33 7 393.53 8...
View ArticleIs it possible to pass TABLE as the output parameter in stored procedure
Hey Experts, Is it possible to pass TABLE as the output parameter in stored procedure.egcreate procedure spGetData(@tableName as TABLE(intValue INT NOT NUL))as
View ArticleHow to do cumulative substraction using T-Sql 2005
Hi ,I want to do cumulative substraction which will do the minus from the previous row's balance.For example in my requirement, I have 100 orders to be completed as mentioned in below screen shot.So,...
View ArticleSql complex query with table valued parameters
I have a list of invoices in the form of a work order which I would like to convert to an invoice. This entails: USE [Trial] GO /****** Object: StoredProcedure [dbo].[SaveAsInvoice_Update] Script...
View Articlehow to find specified value from link in sqlserver
Dear all, SELECT '<span class="Hlink" ><a HREF="" onclick="abc.aspx?abcId=123456789&abcdetailId=987654321">173648IP</a></span>'i want to find out value of "abcid" that is...
View ArticleVery Bad performance with high stress on Tempdb
Hello ,below is the execution plan for a query rapidly increase the Tempdb and has very slow performance,appreciate your suggestion to enhance this query (any data is available upon request)
View ArticleDifferent row counts between SQL management studio and Visual Studio
HiI'm pulling data from a NAV database using a stored procedure containing a Pivot (due to bad table design), the problem is my SQL management studio is returning 53 rows of records yet Visual studio...
View Articlet-sql 2012 max date and self join to other tables
In a sql server 2012 I would like to join a table to other tables by CustomerNumber. The table called 'Inventory' that I want to join to other tables has the following characteristics: 1. The...
View Articleis there any thing availabe (reliable) which can formate the stored...
Dear all,Is there any thing avialable which can formate , indent stored procedurefor if then else , cases, joint etc.yours sincerley
View Article