Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: 747576
  • Content: Threads
  • Order by date
  1. 747576

    dynamically split a numeric range using T-SQL

    Hi, The sql below creates a temporary table that populates numeric ranges, basically I can define a numeric range i.e. 0 to 200 and the number of splits i.e. 4, the query then splits the range into 4 intervals. The split column is my split id, so I know which is the 1st, 2nd, 3rd interval and...
  2. 747576

    Conversion failed when converting varchar to data type int

    Hi, I have a piece of sql that composites data to a specified interval (@compositeby). If I want to composite the data in the table by a float value (not an integer) then I get an error. In the code below the @compositeby is set as 2.5, but it gives me an error: Msg 245, Level 16, State 1...
  3. 747576

    Dynamic sql - Pivot

    Hi, I am using SQL Server 2005, I would like to know the best way to dynamically pivot data from a table using a table valued function. In the code below I have an ID, TYPE, SerialNumber and SEQ column, I would like to pivot the data to give the following example: ID 4145_1 4143_1...
  4. 747576

    Dynamic sql

    Hi, I have a normalised table called RESULTS, which contains water values. I would like to pivot the values so there is a column for each type. I am able to do this with sql below and the result is: ID Water_1 Water_2 Water_3 1A 0.01 0.01 0.01 1A 0.013...
  5. 747576

    sql to combine data from a table

    Hi, I would like to know how to amalgamate interval data using t-sql. The code below creates a temp table and I would like a query to amalgamate the intervals grouping by the field CODE, I can use the sql select id,min(INVFROM),max(INVto),code from #temptable group by id,code but this...
  6. 747576

    vbscript to copy files using array

    Hi, I want to copy files from an array to a destination folder, I also want to check the date as well. I tried the following script and get an error: Expected end of statement Dim FilesToCopy As String Dim sCopy() As String Dim i As Integer FilesToCopy =...
  7. 747576

    Subtract from alphanumeric string value

    I would like some help with the following query. The sql is designed to subtract 1 from the aplhanumeric value in the column ID and show the result in column [PREV_ID] The combination of numeric and non-numeric characters can vary. For example the prefix can vary like: BD001 or 1234/01c...
  8. 747576

    Sql syntax to insert into a sequece of row id's

    Hi there, The code below creates a table of data called ORIGTABLE, this table has a id column called ORIGID, that increments by 1, for example 'ID1_001','ID1_002 and so on. I have another table called TESTTABLE, which contains an id column called TESTID. The idea is that the user selects a...
  9. 747576

    Windows Batch script and SQL

    Hi, Is it possible to have sql return a comma separated list (string) of file names that exist in a folder. This can be done using a batch command script or VBScript, it will be return the file names in a specified folder, but how do I incorporate this into an sql statement or sql sp. Thank you
  10. 747576

    DATETIME

    Hi there, I am getting the following error when casting the date '24/08/2007 10:40:00' in the sql below: select cast('07/04/2009 14:57:00' as DATETIME) ok select cast('24/08/2007 10:40:00' as DATETIME) The conversion of a char data type to a datetime data type resulted in an out-of-range...
  11. 747576

    Composite sql

    Hi, This relates to thread thread183-1496513 which I am revisiting and need some more help with sql: In the following code example I have a table of TEST id's that I want to composite into 3, so 1 composite is a combination of 3 test id's, this works fine. When I add the TYPE column to the...
  12. 747576

    sql, incrementing numbers

    Hi, Is there a mathematical function or code in sql that will work out if a value is a multiple of 3. In my database a value entered into a column in my table can only increment by 3, so 3, 6, 9, 12.... is ok, 1,2,4,5,7....not ok is there way of checking a value using a function. Thank you
  13. 747576

    pass varialble to table function insert

    Hi, This question relates to question: thread183-1545958 I have a dynamis sql statement that returns a view of results. I'd like to use the same statement in a table function, which I can pass the variable @type into. When I constructed the function I recieved the error : "An INSERT statement...
  14. 747576

    dynamic sql

    Hi, I am using sql 2005. I would like some help with select data from 3 normalised tables, but dynamically. I have 3 tables HEADER, RESULT and TYPE. The TYPE table is like a reference table for the NAME field in RESULT. I want to select the results from the HEADER and RESULT tables but pivot...
  15. 747576

    SQL Authentication password

    Hi, It'd be appreciated if you could let me know if it's possible to be able to set the SQL authentication to be able to prompt users to change their password as in windows authentication, every 90 days. Thank you
  16. 747576

    string syntax

    Hi, I would like to split the values in a string: if I have a string 'ab+cfr+ddf' select 'ab+cfr+ddf' and I would like a column: ab cfr ddf or be able to select the 1st code 'ab' or the 2nd 'cfr' or 3rd 'ddf' using sql. Thank you
  17. 747576

    Dynamic sql

    Hi there, I am trying to generate some dynamic sql to print sql statements that can be copied and used to insert data into a table. Below is some sql that first creates a temp table, then a procedure to generate the insert statements and the usage. --TEMP TABLE CREATE TABLE...
  18. 747576

    Error converting data type varchar to bigint

    Hi, I am trying to convert values from the ROWID column in a table to a comma delimited list, like: 2,4,6,8,10 I am using a function, which used the ROW_NUMBER() function and keep getting the error: Error converting data type varchar to bigint Here is the code: CREATE TABLE...
  19. 747576

    return every nth record

    Hi, I am trying to write a query to return every nth record i.e. every 20th I am using the sql: select * from TABLE where RIGHT(ID,4) % 20 = 0 and ID like 'TEST%' where the ID is like 'TEST0001' and so on. I have 100 records for example but if returning every 20th record I'd expect my...
  20. 747576

    UNPIVOT

    Hi, I would like some help with some sql I am trying to develop to UNPIVOT a flat table, and normalise the data. AT_TEMP is the flat table, I am using the UNPIVOT fuctionality in sql but with unions to get the results, I'd like to know how to make it more dynamic so I don't have to use unions...

Part and Inventory Search

Back
Top