SELECT query Assistance
The datastructure for this set-up is 2 tables. One holds the actual data, one holds the field names. So for example, tableName holds the fields, employeeFirstName, employeeLastName, employeeStore,...
View ArticleCreate view with 3 tables of which T1 points to T2 and T3 and T2 points to T3...
newbie at creating Views needing some help. I have 3 tables. T1 is the work order header table.T1 has a column called 'Part ID' to identify the fabricated part. T2 has a list of all the parts that are...
View ArticleBasic Update Question
Dear Group,I have two tables in two different R2 databases. We will call them Table1 and Table2 for convenience. I would like to update records in Table2 from the values of rows in Table1. I would like...
View ArticleParameter not giving value that it's attributed with
hi there, i am currently having a (what some of you might consider a very simple) Problem which is really confusing me.i am doing the following: DECLARE @Jan as nvarchar SET @Jan = '200 €'and...
View ArticleSQL cursor variable not working
My cursor variable @ProductNumber is not working if used in dynamic statement? It says "Must declare scalar variable". But this is a cursor variable. But when I used it not dynamic, it works. Please...
View ArticleHow to insert values in two relational tables?
I have created four tables which all are related to each other as follows:Table 1: ProjectPrjID (Primary key) and ProjectTitleTable 2: StudentStdID(Primary key) PrjID(Foreign Key) and StdNameTable 3:...
View ArticleSQL 2012 64 Bit Linked Server to Excel 2013 64 Bit
What is the syntax for sp_AddLinkedServer to add an Excel 2013 64 bit Workbook as a Linked Server for 64 bit SQL Server 2012?
View ArticleHow to get all field names in a table using sql query?
Hi,How canI get all field names in a table using sql query? Now I am not interested in the data in this table, what I am interested in is just the schema, i.e. all field names. Thanks.
View ArticleIs 'YYYY-MM-DD' not valid for SQL Server?
'YYYYMMDD' and 'YYYY-MM-DD' are valid ANSI date strings.BOL: "date YYYY-MM-DD 0001-01-01 through 9999-12-311 day3NoNo"LINK: http://technet.microsoft.com/en-us/library/ms186724.aspxI...
View ArticleExecuting Sybase Stored procedure from Sql Server 2008 using Linked Server
I have checked previous threads but no use....here is my issueI am using Linked server created in SQL Server 2008 R2 to connect to Sybase db. The Linked Server works as it gives required results when...
View ArticleSQL 2008 substring date
Sorry guy but in SQL Server 2008 R2 having a date as 2012-05-10how can I retrieve a fromat like 201205 . I tried with substring, concat and stuff like this but I went into a loop...the last was...
View Articlehow to update the order from 1 to .... based on start order and end order?
Hello All,I have below table/data structure,DECLARE @TBL TABLE (START_ORD INT, END_ORD INT, ENTITY_NAME VARCHAR(10), ENTITY_ORDER INT) INSERT INTO @TBL VALUES (1, 0, 'ABC', 5), (1, 1, 'ABC1', 8), (1,...
View ArticleSyntax Error In Query
Can someone fix this query for me? I have been at it for an hour and can't locate the rogue errorISNULL(CAST(CONVERT(DECIMAL(18,4)(COUNT(CASE WHEN soldStatus IN ('Yes', 'Pending') THEN saleTotal ELSE...
View ArticleSelect Rows only have Maximum Rating in Joined table.
Hi All, I am currently writing a query in sql server 2008, I have following 3 tables and looking for a following output (mention below), but I cannot work out with query.Table 1:...
View ArticleGet error message from a nested/encrypted stored procedure
Hi,I have an encrypted procedure, that is used inside my 'own' complex procedure as:Begin try Begin tran Do a lot insert into #tmp exec xp_encryptedSP Do a lot more commit tran end try begin catch...
View Articlewhat account does bulk-insert use when running from ssms?
I have an import where I am using bulk insert I am able to access the shared folder but when I use the bulk insert i get an error access is denied?
View ArticlePlease optimize the query
Hi,I have a query that will select the same tables and using Subquery. The query is taking too much time as the table has more records. Can anyone help to modify the query which can take minimum time....
View ArticleStartDate and EndDate values are multiplied, Can't get the right values
Building: Im trying to build a report where I can calculate the difference between two dates (Example between 1-1-2001 and 31-12-2001) but also showing (per name per identifier) the current balance of...
View Articlehow to get difference of two rows as third row
hi..i want to calculate variance of row..for example salary of employeeemp_code month basic hra splall da ltaa001 jan100005000500080007000a001...
View ArticleLookup to find
Hello, I have two CTE and the first returns records like:Item, date used123 , 03/01/2013123, 05/13/2013The second CTE returns:item, Date stocked123, 01/01/13123, 02/15/13123, 04/16/13123,...
View Article