I got some help in another thread to create this table-valued function:
CREATE FUNCTION dbo.GetAwdYrTbl ()
RETURNS @AwdYrTbl TABLE (
AwdYr VARCHAR(7)
, YearID VARCHAR(2)
, Nbr VARCHAR(1)
)
BEGIN
Declare @TodayYr VARCHAR (4)
Declare @TodayMn VARCHAR (2)
Declare...
I've got a query that works perfectly when run on its own and returns what I need it to. When I try to wrap it into a view as displayed below, I'm getting an error "Must declare the table variable "@AwdYrTbl"
I'm sure this is some kind of syntax thing I'm doing wrong. How can I fix it?
--...
I've got working code (thanks to help from this forum) that will write to a file the first 42 characters of each line in numerous files. Works like a charm. However, I now have a need to also write characters from 10 other areas of each line.
For instance, in the code below, i need to modify...
Trying to write a script to move files with last month's date in the filename to an archive folder that exists in the same folder. For instance:
C:\_Temp_Delete\Daily Reports\Report 1 folder --> this is where the file initially resides
C:\_Temp_Delete\Daily Reports\Report 1...
I've been able to string together the basic code for what I want by searching TekTips and other sites. The code below will search a network share for a particular file and write the folder|filename to a text file. What I need is for it to search multiple directories that have a similar...
SQL Server 2005, trying to insert multiple records into table variable using one insert statement (no problem) and a CASE statement (problem). Here is a snippet:
...
DECLARE @YrTbl TABLE
(Yr VARCHAR(7))
SET @TodayMn = MONTH(getdate())
SET @TodayYr = YEAR(getdate())
SET @2Years =...
I've got a table that contains an error code field that can contain multiple error codes (001, 002, 003...) and it is joined to a reference table that contains the values of the codes and their corresponding descriptions:
Tbl1
ErrorCode char(75)
Tbl2
ErrorCode char(3)
Descript char(1000)
In...
I'm trying to produce a crosstab to move rows into columns using CASE statements. Trying to stay away from PIVOT because there are multiple columns I want to move and it looks like PIVOT will be too complex.
Tables: Person, Schedule
Schedule table has multiple records for one Person. I've got...
I have a SUMFormula that does a SUM(@OtherFormula1) + SUM(@OtherFormula2). I want to do a Group Sort using the SUMFormula, but it's not listed in the Group Sort Expert for my group.
How can I sort on this thing? CR XI, SQL Server 2005.
I am trying to get user and security group data from two different tables (users & secgroup). However there is no join between the two tables. There is a third table (secbygrp) that allows a one-to-many join from each of the first two tables. For instance:
users.id
secgroup.groupid
secbygrp.id...
I've got a CR (XI) calling a SP (SQL Server 2005) but returning no data. So I go to check out the (new, by the way) SP. It looks something like this:
@Prm char
AS
SELECT tbl1.fld1, tbl2.fld1, tbl3.fld1, tbl1.fld2, tbl2.fld2, tbl3.fld2
FROM (TABL1 tbl1 INNER JOIN TABL2 tbl2 ON tbl1.fld1 =...
I'm not a programmer, but I play on on TV. I've got a report (CR v11) that uses a formula to change string field to date (@Yesterday). Then selection formula that says {@Yesterday} = CurrentDate -1
The reports run against a SP, which looks like this:
ALTER PROCEDURE [dbo].[_spNumbers]...
I have about 10 years of experience as an IT pro. I'm employed full-time/perm and, for the first time, I am looking to get some part-time telecommuting contract work. Have an offer on the table and I've submitted my proposed hourly rate based on my experience and FT salary. I've been upfront...
I've got an HTA that I would like to be able to run from a .mht file. This is for a prototype of an application that I would like to demo to my co-workers. All the files are local to my machine. However, when I attempt to run the HTA from the web browser, I'm still getting security warnings...
I've got an HTA that offers the ability to open 3 other HTAs. On the "Close" button of the main HTA, I want all 4 HTAs to close. I'm using the code below, but the problem is when I run it, the main HTA closes right away, before it has a chance to close the 3 "child" HTAs, so they remain open. Is...
Using CR 8.5 on Oracle 8.1 db. My table looks like this:
LoginID FullName Mgr
JONESB Bob Jones ROTHT
SMITHJ Joe Smith ROTHT
ROTHT Tim Roth KENTJ
KENTJ Jim Kent KENTJ
In my report, I'm grouping by FullName and trying to show each person's manager. But instead...
I've got an app with a Supply table and a Detail table. Detail table/screen has 6 different "Item" and "Quantity" fields, so you can order up to 6 items. Each item field can select any item from the Supply table.
Supply.idno -> Detail.item1
...
Supply.idno -> Detail.item6
So from any Detail...
I've got the following code running in a procedure, called by a KSH script. It does what it needs to do (delete dup records), but it takes a long time to complete. I realize there's some redundancy here, but I can't seem to get it to work any other way I've tried. I would appreciate help in...
I am inserting rows from one table into another table. The source table has no primary key. The destination table has a combo primary key on two columns...CallID and Seq.
I've got data that looks like this in source table:
CallID Seq col_x
123456 1 x...
123456 2 y...
123456 1...
v8.5...I'm having a problem with my printer setup options. I had to go in here yesterday to try to resolve another issue. Somehow I set up the default print options to print on Size 6x9 Envelope instead of 8.5x11 paper.
Now every time I go into Printer Setup, I can change it to 8.5x11 and...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.